org.broadleafcommerce.core.web.processor
Class GoogleAnalyticsProcessor
java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementProcessor
org.broadleafcommerce.common.web.dialect.AbstractModelVariableModifierProcessor
org.broadleafcommerce.core.web.processor.GoogleAnalyticsProcessor
- All Implemented Interfaces:
- Comparable<org.thymeleaf.processor.IProcessor>, org.thymeleaf.processor.IProcessor
public class GoogleAnalyticsProcessor
- extends AbstractModelVariableModifierProcessor
A Thymeleaf processor that will on order confirmation page, submit order
information via javascript to google analytics.
Example usage on order confirmation page:
<blc:googleAnalytics th:attr="orderNumber=${order != null ? order.orderNumber : null}" />
<script th:utext="${analytics}" />
- Author:
- tleffert
| Methods inherited from class org.thymeleaf.processor.element.AbstractElementProcessor |
doProcess, getMatcher |
| Methods inherited from class org.thymeleaf.processor.AbstractProcessor |
compareTo, getMessage, getMessageForProcessor, getMessageForTemplate, process |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
orderService
protected OrderService orderService
webPropertyId
@Value(value="${googleAnalytics.webPropertyId}")
protected String webPropertyId
affiliation
@Value(value="${googleAnalytics.affiliation}")
protected String affiliation
testLocal
protected boolean testLocal
- This will force the domain to 127.0.0.1 which is useful to determine if the Google Analytics tag is sending
a request to Google
GoogleAnalyticsProcessor
public GoogleAnalyticsProcessor()
- Sets the name of this processor to be used in Thymeleaf template
getPrecedence
public int getPrecedence()
- Specified by:
getPrecedence in class org.thymeleaf.processor.AbstractProcessor
modifyModelAttributes
protected void modifyModelAttributes(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
- Specified by:
modifyModelAttributes in class AbstractModelVariableModifierProcessor
analytics
protected String analytics(String webPropertyId,
Order order)
- Documentation for the recommended asynchronous GA tag is at:
http://code.google.com/apis/analytics/docs/tracking/gaTrackingEcommerce.html
- Parameters:
webPropertyId - - Google Analytics IDorder - - optionally track the order submission. This should be
included on the page after the order has been sucessfully
submitted. If null, this will just track the current page
- Returns:
- the relevant Javascript to render on the page
getVariation
protected String getVariation(OrderItem item)
- Returns the product option values separated by a space if they are
relevant for the item, or the product category if no options are available
- Returns:
getBillingAddress
protected Address getBillingAddress(Order order)
setTestLocal
protected void setTestLocal(boolean testLocal)
getTestLocal
public boolean getTestLocal()
getAffiliation
public String getAffiliation()
setAffiliation
public void setAffiliation(String affiliation)
Copyright © 2013. All Rights Reserved.