- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
03-16-2016 02:23 PM
I'd like to attach a event listener to a button that fires a Google Analytics event when it is clicked. I set it up, but I can't get it to send to GA. Any suggestions?
I created a tag with a load rule to target my specific page.
I then created a javascript extension that is scoped to that tag. In the extension I have
$(".social-widgets a" ).click(function() { console.log( "Handler for .click() called." ); ga('send', 'event', 'details_share', 'details_share', 'details_share_email'); });
When it is clicked the console logs it, but it doesn't send it to GA. Do I need to put more info into the function to connect it to GA? I've verified that GA is on the page and working properly.
03-17-2016 08:07 AM
Hi @tester1234,
You can accomplish this using a jQuery onHandler Extension in TiQ, then mapping the event category, action, label to the Google Analytics tag. Please see the screen shots and visit jQuery onHandler Extension for more info. Let me know if you have any more questions.
1.
2.
Copyright All Rights Reserved © 2008-2023