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
Component which helps building google analytics event URIs.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The domain hash.static final String
The analytics GIF URL.static final String
Token to replace in the url by a random UTMHID valuestatic final String
Token to replace in the url by a random UTMN valuestatic final String
The analytics API version.static final String
Token to replace in the url by a random VisitorID valuestatic final String
The avalon component role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionencodeValue
(String value) Encode a value to use as an identifier component.getEventGifUri
(String gaWebId, String eventIdentifier) Get an event GIF URI.getEventGifUri
(String gaWebId, String eventIdentifier, boolean usePlaceholderTokens) Get an event GIF URI.getEventGifUri
(String gaWebId, String category, String action, String label) Get an event GIF URI.getEventGifUri
(String gaWebId, String category, String action, String label, int value) Get an event GIF URI.getEventGifUri
(String gaWebId, String category, String action, String label, int value, boolean nonInteraction) Get an event GIF URI.getEventIdentifier
(String category, String action, String label) Compute an event identifier.getEventIdentifier
(String category, String action, String label, int value) Compute an event identifier.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 Details
-
ROLE
The avalon component role. -
GA_GIF_URL
The analytics GIF URL.- See Also:
-
GA_VERSION
The analytics API version.- See Also:
-
DOMAIN_HASH
The domain hash.- See Also:
-
GA_VISITORID_TOKEN
Token to replace in the url by a random VisitorID value- See Also:
-
GA_UTMN_TOKEN
Token to replace in the url by a random UTMN value- See Also:
-
GA_UTMHID_TOKEN
Token to replace in the url by a random UTMHID value- See Also:
-
-
Constructor Details
-
GAUriBuilder
public GAUriBuilder()
-
-
Method Details
-
getEventGifUri
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
Get an event GIF URI.- Parameters:
gaWebId
- the GA web ID.eventIdentifier
- the event identifier.- Returns:
- the event GIF URI.
-
getEventGifUri
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
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.
-