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 data-track-category and data-track-label.

In other words:

<a href="[label]">[category]</a>
<a href="http://www.google.com" data-track-category="[category]" data-track-label="[label]">Go to Google</a>

Programatic event tracking

You can track an event any time in javascript by calling this helper function:

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")