Hi all,
I am having trouble getting maxigallery to call an onclick.
I followed googles tute on how to add analytics and track out going links but maxigallery seams to be re-writing my link?
That’s my guess. If so how/where do I change maxi’s code to stop removing this the onclick.
In the source code the link looks like this:
<a href="http://www.facebook.com/" title="http://www.facebook.com/" class="open" onClick="recordOutboundLink(this, 'Advertisment Links', 'http://www.facebook.com/');return false;"></a>
<img src="/assets/galleries/7/correct_dimensions_for_ad.jpg" class="full" alt="correct_dimensions_for_ad.jpg" />
<img src="/assets/galleries/7/tn_correct_dimensions_for_ad.jpg" class="thumbnail" alt="correct_dimensions_for_ad.jpg" />
I just modified the maxigallery template file:
And turned on embededlinks in the maxi call, so clicking the image works.
But in code checkers like Firebug for firefox the link looks very different. It adds a target="_blank" so is this why the onclick isn’t called?
Here is my onclick call and analytics call, both just above the </head> call:
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try{
var pageTracker = _gat._getTracker("UA-xxx-82");
pageTracker._trackEvent(category, action);
setTimeout('document.location = "' + link.href + '"', 100)
} catch(err) {}
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxx-82']);
_gaq.push(['_trackPageview']);
var pageTracker = _gat._getTracker("UA-xxx-82');
pageTracker._trackPageview();
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Confused!?