Last active
December 15, 2015 00:18
-
-
Save ianstormtaylor/5171508 to your computer and use it in GitHub Desktop.
How to track multiple links and add link-specific properties for the event by using a callback method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Grab a bunch of links. | |
var $links = $('.free-trial-links'); | |
// Call `trackLink` with your links, and a callback function instead | |
// of a normal `properties` object. The function will receive the | |
// link element that was clicked as it's first argument. | |
analytics.trackLink($links, 'Clicked Free-Trial Link', function (link) { | |
return { | |
href : $(link).attr('href'), | |
name : $(link).text() | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment