Class MatomoRequestCustomVariablesEnricher

java.lang.Object
org.dspace.matomo.factory.MatomoRequestCustomVariablesEnricher
All Implemented Interfaces:
MatomoRequestDetailsEnricher

public class MatomoRequestCustomVariablesEnricher extends Object implements MatomoRequestDetailsEnricher
This class adds the _cvar parameter to the MatomoRequestDetails
Author:
Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.com)
  • Field Details

  • Constructor Details

    • MatomoRequestCustomVariablesEnricher

      public MatomoRequestCustomVariablesEnricher()
  • Method Details

    • enrich

      public MatomoRequestDetails enrich(UsageEvent usageEvent, MatomoRequestDetails matomoRequestDetails)
      Description copied from interface: MatomoRequestDetailsEnricher
      Enriches the provided MatomoRequestDetails with additional parameters based on the UsageEvent.
      Specified by:
      enrich in interface MatomoRequestDetailsEnricher
      Parameters:
      usageEvent - The usage event containing information to enrich the request details
      matomoRequestDetails - The request details object to be enriched with additional parameters
      Returns:
      The enriched MatomoRequestDetails object
    • parse

      public static Map<Integer,Map.Entry<String,String>> parse(String value)
      Parses a JSON representation of custom variables.

      The format is as follows: {"1":["key1","value1"],"2":["key2","value2"]}

      Example: {"1":["OS","Windows"],"2":["Browser","Firefox"]}

      This is mainly used to parse the custom variables from the cookie.

      Parameters:
      value - The JSON representation of the custom variables to parse or null
      Returns:
      The parsed custom variables or null if the given value is null or empty