Important:
This support area is for Kalium 3 users only.
Support for Kalium 4 has moved to our new platform at support.laborator.co.
If you’re using Kalium 4, please create a new account there using your email and license key. A password will be sent to you automatically.
How to sent onClick events to Google Analytics? I have the analytics js pasted into the Footer option in the theme config.
I have tried this: <a onClick="ga('send', 'event', 'Link', 'Click', 'App', '0');" href="url"> and onclick="__gaTracker( ... " to no avail.
My preference would be not to use another plugin.
Hi Phil,
You can do this with jQuery,
<script type="text/javascript"> jQuery( document ).ready( function( $ ) { // Bind click events jQuery( 'a' ).on( 'click', function( e ) { ga('send', 'event', 'Link', 'Click', 'App', '0'); } ); } ); </script>Maybe this could work for you?
Hi -- Thanks. Could I add this to the footer field in themes.php?page=theme-options#footer-custom-js
I would like the flexibility to pass different values to the event depending on the button/link. Or have the script pass the label of the link/button to Google. Is this possible?
Hi Phil,
It depends what information you want to pass and which links do you target, for example you can pass the Link Name (value) in this form:
Where do I add this script. To the top of each portfolio post. Or to the footer? Or in header.php?
Hi Phil,
You need to place that code on Theme Options > Footer > JavaScript & Tracking Code > Footer JavaScript