View asynchronous JavaScript calls

I updated the tracking script for Google Analytics in the asynchronous version. The only problem I am facing is call debugging. I was able to track an older version of Firebug using the approach described on this site , but now cannot view gaq.push calls. Is there a way to view this in Firebug or another tool?

This is my test test page I'm trying to track:

<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Google Analytics Event Tracking</title> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-13250000-1']); _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> </head> <body> Lorem ipsum dolor sit amet....<br /> <script type="text/javascript"> _gaq.push(['_trackEvent', 'Videos', 'Play', 'Gone With the Wind']); </script> </body> </html> 

I am trying to confirm that "_gaq.push" actually works.

+4
source share
4 answers

TamperData plugin for Firefox is very convenient. It allows you to see all HTTP traffic with filtering, etc. It also has a tool that allows you to change the headers before the browser starts the HTTP transaction, which seems pretty intimidating, but I never used it.

+1
source

I just ran into the same problem, and so I did a google search and ended up in this question. I also thought that this would just display as an xhr request in firebug, as that would be an easy way to track the event. Turns out they use a 1x1 pixel gif for tracking! If you look at the "Network"> "All" tab in Firebug, you will see a GET request similar to this:

 https://ssl.google-analytics.com/__utm.gif?utmwv=5.2.4&utms=28&utmn=1818843630&utmhn=dev-marketplace.asos.com&utmt=event&utme=5(my-home*sub-nav-click*blog-posts)&utmcs=UTF-8&utmsr=1920x1080&utmvp=1920x618&utmsc=24-bit&utmul=en-gb&utmje=0&utmfl=11.1%20r102&utmdt=Build%20%23%20Developer%20Live%20Feed%20ASOS%20Marketplace&utmhid=1950484512&utmr=-&utmp=%2Flivefeed%2Fblogposts&utmac=UA-23521416-1&utmcc=__utma%3D159014575.706813547.1328542287.1328542287.1328604985.2%3B%2B__utmz%3D159014575.1328542287.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=6AAAAAAAAAAAAAAAQ~ 

These are the parameters sent in the request.

 utmac UA-23521416-1 utmcc __utma=159014575.706813547.1328542287.1328542287.1328604985.2;+__utmz=159014575.1328542287.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); utmcs UTF-8 utmdt Build # Developer Live Feed ASOS Marketplace utme 5(my-home*sub-nav-click*blog-posts) utmfl 11.1 r102 utmhid 1950484512 utmhn dev-marketplace.asos.com utmje 0 utmn 1818843630 utmp /livefeed/blogposts utmr - utms 28 utmsc 24-bit utmsr 1920x1080 utmt event utmu 6AAAAAAAAAAAAAAAQ~ utmul en-gb utmvp 1920x618 utmwv 5.2.4 
+2
source

I do this by looking at the Resources tab in the Chrome Developer Tools:

http://drktd.com/45VJ (note the yellow "XHR" - this means XMLHttpRequest, which is the kind of call you're probably looking for)

If you require a detailed presentation of each request to / from your system, you really need to install Charles Proxy. This is the best breed for this kind of thing.

0
source

If you do not see requests occurring in FireBug, then they do not occur. Google Analytics in no way wraps the browser’s ability to track what HTTP requests it makes; your code simply doesn’t.

0
source

Source: https://habr.com/ru/post/1336170/


All Articles