Event tracking‹ Back
Event tracking hooks in to the external links script. You can open
external_links.js and adjust the settings to match your requirements. You can switch between ga.js and analytics.js tracking types and enable debugging.
By default, the category is the text in the link. The label is the URL that the link goes to.
eg. If you had a link named "Test Link" and it goes to "http://google.com", the category will be saved as "Test Link" and the value will be saved as "http://google.com".
You can over-ride both of these settings by passing in data attributes on a link on a case-by-case basis with
In other words:
<a href="http://www.google.com" data-track-category="[category]" data-track-label="[label]">Go to Google</a>
Programatic event tracking
Ornament.C.Analytics.trackEvent(category, label, type)
The category and label are required to send the event to analytics. If no type is specified it will default to "click"
An example event might be when a register modal is shown:
Ornament.C.Analytics.trackEvent("Modal Shown", "Register")
Programatic virtual pageview
Virtual pageviews can be handy for situations where you might want to track filters used, especially in cases where the history API is implemented.
trackVirtualPageview function takes a URL to track and you can optionally pass in a page title to track with it. If no page title is passed in it will track the URL with the current page title, which should be fine in most cases.