Package org.ametys.plugins.newsletter.ga
Class GAUriBuilder
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.newsletter.ga.GAUriBuilder
-
- All Implemented Interfaces:
Component
,LogEnabled
public class GAUriBuilder extends AbstractLogEnabled implements Component
Component which helps building google analytics event URIs.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DOMAIN_HASH
The domain hash.static String
GA_GIF_URL
The analytics GIF URL.static String
GA_UTMHID_TOKEN
Token to replace in the url by a random UTMHID valuestatic String
GA_UTMN_TOKEN
Token to replace in the url by a random UTMN valuestatic String
GA_VERSION
The analytics API version.static String
GA_VISITORID_TOKEN
Token to replace in the url by a random VisitorID valuestatic String
ROLE
The avalon component role.
-
Constructor Summary
Constructors Constructor Description GAUriBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
encodeValue(String value)
Encode a value to use as an identifier component.String
getEventGifUri(String gaWebId, String eventIdentifier)
Get an event GIF URI.String
getEventGifUri(String gaWebId, String eventIdentifier, boolean usePlaceholderTokens)
Get an event GIF URI.String
getEventGifUri(String gaWebId, String category, String action, String label)
Get an event GIF URI.String
getEventGifUri(String gaWebId, String category, String action, String label, int value)
Get an event GIF URI.String
getEventGifUri(String gaWebId, String category, String action, String label, int value, boolean nonInteraction)
Get an event GIF URI.String
getEventIdentifier(String category, String action, String label)
Compute an event identifier.String
getEventIdentifier(String category, String action, String label, int value)
Compute an event identifier.String
getEventIdentifier(String category, String action, String label, int value, boolean nonInteraction)
Compute an event identifier.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
GA_GIF_URL
public static final String GA_GIF_URL
The analytics GIF URL.- See Also:
- Constant Field Values
-
GA_VERSION
public static final String GA_VERSION
The analytics API version.- See Also:
- Constant Field Values
-
DOMAIN_HASH
public static final String DOMAIN_HASH
The domain hash.- See Also:
- Constant Field Values
-
GA_VISITORID_TOKEN
public static final String GA_VISITORID_TOKEN
Token to replace in the url by a random VisitorID value- See Also:
- Constant Field Values
-
GA_UTMN_TOKEN
public static final String GA_UTMN_TOKEN
Token to replace in the url by a random UTMN value- See Also:
- Constant Field Values
-
GA_UTMHID_TOKEN
public static final String GA_UTMHID_TOKEN
Token to replace in the url by a random UTMHID value- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GAUriBuilder
public GAUriBuilder()
-
-
Method Detail
-
getEventGifUri
public String getEventGifUri(String gaWebId, String category, String action, String label)
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.category
- the event category.action
- the event action.label
- the event label.- Returns:
- the event GIF URI.
-
getEventGifUri
public String getEventGifUri(String gaWebId, String category, String action, String label, int value)
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.category
- the event category.action
- the event action.label
- the event label.value
- the event value.- Returns:
- the event GIF URI.
-
getEventGifUri
public String getEventGifUri(String gaWebId, String category, String action, String label, int value, boolean nonInteraction)
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.category
- the event category.action
- the event action.label
- the event label.value
- the event value.nonInteraction
- true if the event does not trigger an interaction.- Returns:
- the event GIF URI.
-
getEventGifUri
public String getEventGifUri(String gaWebId, String eventIdentifier)
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.eventIdentifier
- the event identifier.- Returns:
- the event GIF URI.
-
getEventGifUri
public String getEventGifUri(String gaWebId, String eventIdentifier, boolean usePlaceholderTokens)
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.eventIdentifier
- the event identifier.usePlaceholderTokens
- True to use tokens instead of randomly generated values- Returns:
- the event GIF URI.
-
getEventIdentifier
public String getEventIdentifier(String category, String action, String label) throws URISyntaxException
Compute an event identifier.- Parameters:
category
- the event category.action
- the event action.label
- the event label.- Returns:
- the event GIF URI.
- Throws:
URISyntaxException
- if an error occurs encoding the event identifier.
-
getEventIdentifier
public String getEventIdentifier(String category, String action, String label, int value) throws URISyntaxException
Compute an event identifier.- Parameters:
category
- the event category.action
- the event action.label
- the event label.value
- the event value.- Returns:
- the event GIF URI.
- Throws:
URISyntaxException
- if an error occurs encoding the event identifier.
-
getEventIdentifier
public String getEventIdentifier(String category, String action, String label, int value, boolean nonInteraction) throws URISyntaxException
Compute an event identifier.- Parameters:
category
- the event category.action
- the event action.label
- the event label.value
- the event value.nonInteraction
- true if the event does not trigger an interaction.- Returns:
- the event GIF URI.
- Throws:
URISyntaxException
- if an error occurs encoding the event identifier.
-
encodeValue
public String encodeValue(String value) throws URISyntaxException
Encode a value to use as an identifier component.- Parameters:
value
- the value to encode.- Returns:
- the encoded value.
- Throws:
URISyntaxException
- if an error occurs encoding the value.
-
-