Skip to content

Instantly share code, notes, and snippets.

@catob
Last active July 28, 2016 12:34
Show Gist options
  • Save catob/db4083211550b15b751bc57702bce5fb to your computer and use it in GitHub Desktop.
Save catob/db4083211550b15b751bc57702bce5fb to your computer and use it in GitHub Desktop.
Tracking examples
// Fires event when user clicks on the View Courses CTA
function courses_cta() {
analytics.track('CF_HP_ClickViewOurCourses', {
'CF_DestinationPage': '',
'CF_ContentSubType': '',
'CF_CTA': '',
'CF_Menu Choice': '',
'Category': 'Home Page Interaction',
'Description': 'User Clicks on "View our Courses CTA Button"',
'nonInteraction': false
});
}
//PageView tracking
analytics.page('Home', {
'Page Type': 'Impact',
'CF_PageCourse': '',
'PageContentType': 'Home',
'CF_Country': '#{I18n.locale}', // returns 'EN' or 'DE'
'CF_PageTitle': document.getElementsByTagName("title")[0].innerHTML,
'CF_PageURL': window.location.href,
'CF_aa_home_page_button_test': '#{@aa_home_page_button}' // This is for the ruby a/b testing tool that I'm using
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment