JQuery to track inactive Google Analytics events

I am trying to use google anayltics events, but so far without any success.

What I am doing is loading 5 pages using the jQuery download function and I want to track the “Next Button” for each download. but it seems like I'm doing something wrong.

This is the following button event code:

            $('.NextButton').click(function () {
                _gaq.push(['_trackEvent', 'fz_main_page', 'clicked']);
                installation.load_page({ inner_page: next_page, comid: data.comid, outerid: data.outerid, single_app: "1" });
            });

Analytics Code:

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-25162785-2']);
    _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>

What am I doing wrong?

+3
source share
1 answer

It is possible that the function installation.load_pageprevents startup trackEvent. Try wrapping your function loadin setTimeout:

setTimeout('installation.load_page({ inner_page: next_page, comid: data.comid, outerid: data.outerid, single_app: "1" })', 100);

Install the Google Analytics Debugger . Look at the console (control, shift, j) to handle event tracking.

enter image description here

, - .

+4

All Articles