Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 4243

Adding Piwik Events with jquery in Wordpress *DELETE POST* (no replies)

$
0
0
***CLOSE ISSUE***

Sorry guys my bad I made a mistake show have been trackEvent instead of _trackEvent.

Works now :)

----------------------------------------------
Hi guys, I know this is a bit more advanced, but was wondering if a piwik/javascript expert can help out.

I want to track events in Piwik and have added the following javascript code to assign a click event to certain elements of my HTML page with Jquery:

<script>jQuery(document).ready(function ($) {
if (typeof(_paq) !== 'undefined') // Check if Piwik is Loaded
{
// MagneticTracking for Piwik
$('.magnetic-text').click(function(){_paq.push(['_trackEvent', 'affiliate click', 'magnetic text', window.location.pathname]); });
$('.magnetic-image').click(function(){_paq.push(['_trackEvent', 'affiliate click', 'magnetic image', window.location.pathname]); });
}
}
</script>

When I inspect the element in firebug I can see that the event is attached to it. However, when I click the element I'm not sure if that code is being run properly or if its even right?

How do you get this to work? I wish I could debug it so when you click on it I can see if that code is being run?

Viewing all articles
Browse latest Browse all 4243

Trending Articles