Is there a trick (or any way) to add an onclick event tracker to a CTA link in a callout or button? Such as:
onclick="_gaq.push([’_trackEvent’, ‘Download’, ‘2016 Conference’, ‘Variant 2’]);"
Thanks!
Is there a trick (or any way) to add an onclick event tracker to a CTA link in a callout or button? Such as:
onclick="_gaq.push([’_trackEvent’, ‘Download’, ‘2016 Conference’, ‘Variant 2’]);"
Thanks!
Hey Andy,
I think this can be achieved via jQuery but I’m not really sure. You can check this thread on SE as it discusses the same thing. I tried achieving the same thing and I end up with this.
jQuery(document).ready(function() {
jQuery(".onclick-test .fl-callout-button a").on("click", function() {
_gaq.push(['_trackEvent', 'Download', '2016 Conference', 'Variant 2']);
});
});
Hope this helps!
Ben
Thanks Ben!
Hey Andy,
No worries! Have fun with The Beaver!
Ben
Any update on if this worked? I guess I can try it for myself.
Hey David,
Sorry to say but I haven’t tried it for myself. Feel free to give it a shot! And if you can report back what you find, that would be awesome!
Ben