Class SendGAEventsEngine
java.lang.Object
org.ametys.plugins.newsletter.workflow.SendGAEventsEngine
- All Implemented Interfaces:
Runnable
Send a google analytics event for every newsletter e-mail sent.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CategoryProviderExtensionPointThe category provider extension point.protected ContextThe avalon context.protected ContextThe cocoon environment context.protected GAUriBuilderThe google analytics URI builder.protected I18nUtilsThe i18n utils component.protected booleanIs the engine initialized ?protected ServiceManagerThe service manager.protected SiteManagerThe site Manager. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringCompute the event identifier for the newsletter sending.protected voidconsumeQuietly(InputStream input) Consume a stream, reading all its data and ignoring errors.voidinitialize(ServiceManager manager, Context context) Initialize the engine.voidparametrize(String siteName, WebContent newsletterContent, Category category, int eventCount) Parameterize enginevoidrun()protected voidSend the event request, given the full GIF URL.protected voidsendEvents(String gaWebId) Send GA events for a given GA user account.
-
Field Details
-
_context
The avalon context. -
_environmentContext
The cocoon environment context. -
_manager
The service manager. -
_initialized
Is the engine initialized ? -
_gaUriBuilder
The google analytics URI builder. -
_categoryProviderEP
The category provider extension point. -
_siteManager
The site Manager. -
_i18nUtils
The i18n utils component.
-
-
Constructor Details
-
SendGAEventsEngine
public SendGAEventsEngine()
-
-
Method Details
-
initialize
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException Initialize the engine.- Parameters:
manager- the avalon service manager.context- the avalon context.- Throws:
ContextException- if an error occurred during initializationServiceException- if an error occurred during initialization
-
parametrize
public void parametrize(String siteName, WebContent newsletterContent, Category category, int eventCount) Parameterize engine- Parameters:
siteName- The site namenewsletterContent- the newsletter contentcategory- the newsletter categoryeventCount- the number of events
-
run
-
sendEvents
Send GA events for a given GA user account.- Parameters:
gaWebId- the google web ID.
-
sendEvent
Send the event request, given the full GIF URL.- Parameters:
eventUrl- the full event GIF URL (with parameters).- Throws:
IOException- if an error occurs sending the GIF HTTP request.
-
computeEventIdentifier
Compute the event identifier for the newsletter sending.- Returns:
- the event identifier.
-
consumeQuietly
Consume a stream, reading all its data and ignoring errors.- Parameters:
input- the input stream to consume.
-