Hi. I am tracking certain clicks on my site with GA event tracking, as well as running a jQuery script to trigger GA events for all outbound link clicks. I also want to enable ecommerce tracking of EJunkie sales. When I substitute the EJunkie version of GA tracking code my scripts stop working. So, how do I get GA event tracking and Ejunkie to work together?
This is the jQuery script that tracks the outbound links:
<script type="text/javascript">
$("a").on('click',function(e){
var url = $(this).attr("href");
if (e.currentTarget.host.replace(/[\d:]/g,"") != window.location.host) {
gaq.push(['trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
if (e.metaKey || e.ctrlKey) {
var newtab = true;
}
if (!newtab) {
e.preventDefault();
setTimeout('document.location = "' + url + '"', 100);
}
}
});
</script>
And this is the script that enables GA event tracking of special links:
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try {
gaq.push(['trackEvent', category , action ]);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
</script>
So how do I make these scripts work with Ejunkie's version of the GA tracking code? Has anyone ever gotten GA event tracking to work with Ejunkie ecommerce tracking?
created
Sep '12
last reply
Sep '12
- 3
replies
- 1.1k
views
- 2
users
- 1
link