We are updating, some features may not work !
Please leave a feedback if you face any problem.

Google Analytics for Ajax Pages

612 Views | Rishi Kashyap | 1 FOLLOW

    Google Analytics for Ajax Pages


    Google Analytics was missing the functionality to measure the Ajax Pages which are generated asynchronously using javascript.  This limitation was finally removed in 2011 when the Google Analytics Tracking Code themselves became asynchronous. Today you will not find the old code.

    For monitoring the Ajax Pages you need to modify the Google Analytics Tracking Code.
    For Example if you have a page say "original.php" which is generally loaded, viewed directly by any user and an Ajax Page say "ajax.php" which is loaded asynchronously in the "original.php" then the Google Analytics Code will be in "original.php" and "ajax.php" will not have any Tracking Code.

    1) Next find the line " _gaq.push(['_trackPageview']);" in your Analytics Tracking Code (probably 4th line)
    2) modify this line to add your ajax page to be monitored, so the line will now look like "_gaq.push(['_trackPageview','ajax.php']);"
    3) Save your "original.php" and upload to your server.

    Now your Google Analytics will monitor Ajax Pages too.
    Remember that the Analytics data will be shown only after 24 hours of modifying the Tracking Code for Ajax Pages !

    Rishi Kashyap | | EDIT | REPLY

      tags  GOOGLE