There are 3 examples, let's review them briefly.
1. Tracking JavaScript Events
Simple Accordion with resources for developers, marketers, etc. Expanding different content blocks will trigger analytic event using the following code:
$(function () { $("#accordion").accordion( { change: function (event, ui) { var event = new AnalyticsPageEvent('Client Event', 'Client Event: Area Expanded - ' + ui.newHeader.context.innerText); event.trigger(); } }); });
Try to click "Download podcast" links. New window will be opened and "Download file from Akamai" event will be triggered. The code is as simple as before:
jQuery(".downloadLink").click(function () { var event = new AnalyticsPageEvent('Download file from Akamai', 'Download file from Akamai - ' + jQuery(this).attr('href')); event.trigger(); });
3. Tracking outgoing links
jQuery("#bottomAccordion a:external").click(function () { var event = new AnalyticsPageEvent('External Link', 'Area Expanded - ' + jQuery(this).attr('href')); event.trigger(); });
And here's what you will see after a series of clicks:
That's not a complete list of tasks that can be done by using the module, but I hope I've explained the basics. Did you like the module? Here are the next steps:
Very cool, thanks for sharing!
ReplyDeleteThank you for this :)
ReplyDelete