Skip to content

Instantly share code, notes, and snippets.

@klongdesigns
Created August 28, 2014 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klongdesigns/8ea3cd87d00c0c677acf to your computer and use it in GitHub Desktop.
Save klongdesigns/8ea3cd87d00c0c677acf to your computer and use it in GitHub Desktop.
Google Analytics event tracking code for WordPress
function sendToGA(pagename,section) {
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'footerLink', // Required.
'eventAction': 'click', // Required.
'eventLabel': 'Footer Link: ' + section,
'eventValue': 4,
'page':'/'+pagename,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment