I need help 'cos I don't know java enough to split this small script up.
I got a website that where I first installed google Event Tracking in to see how many
shows there is on that site.
I got this small script from google at the bottom in the index.php file:
Code:
...
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XX-88888888-8']);
_gaq.push(['_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>
</body>
</html>
Now I want to do almost the same 'gaq.push' but in another place and that code looks something like this:
Code:
if (substr($d['image'],0,4)=="http"){
return '
<div class="images">
<a href=clicks.php?id='.$d['id'].' target="_blank" >
<img name="WE" src="'.$d['image'].'" alt="'.$d['view'].'"
width="913" height="61" margin: 0 auto;
/>
</a>
</div>';
}
now I want to add this:
Quote:
onclick="_gaq.push([\'_trackEvent\', \'category\', \'action\', \'label\']);"
|
in there and I tried but it didn't work, but no errors just that google didn't get any of the info.
I think the
'(function() {...' from the first code shown needs to be there somewhere too but I don't know how to split this up and need help.
Best thing would be if I could place the
'(function() {...' in a separate .js file that I can place with the rest of the
scripts and then use that elsewhere when ever needed... somehow.
Can anyone help me out with this?