Javascript Analytics Code Manipulation (G. Analytics)

for my work I am doing a research project on the validity of Google Analytics (mainly regarding verified flippa reports) β†’ see if G. Analytics can be completely faked (simple Yes, it won’t cut it)!

I modified the G. Analytics code as follows:

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-19629541-5']); _gaq.push(['_setAllowHash', false]); _gaq.push(['b._setAccount', 'UA-19629541-5']); _gaq.push(['b._setAllowHash', true]); for (var i=0;i<=10;i++) { _gaq.push(['_trackPageview']); _gaq.push(['b._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); })(); 

Now it launches several visits and visitors at startup. You can see that the second number on __utma changes for each page view, this number is a client, when it changes, it means that you get a new visitor

The problem is that the statistics I get now looks like this:

  • Visits: 1,785
  • Unique Visitors: 1,781
  • Page Views: 2,188
  • Pages / Visit: 1.23
  • Avg. Duration: 00:00:03
  • Bounce Rate: 96.13 %%
  • New visits: 99.78%

Please do not reduce the reduction in avg. duration of visit!

before they look like this:

  • Visits: 135
  • Unique Visitors: 118
  • Page Views: 383
  • Pages / Visit: 2.84
  • Avg. Duration: 00:04:22
  • Bounce Rate: 57.78%
  • % New visits: 68.89%

Now my question is: how do I need to change the G. Analytics code (if at all possible) so that it looks something like this:

  • Visits: 135 * 10 = 1350
  • Unique visitors: 118 * 10 = 1180
  • Page Views: 383 * 10 = 3830
  • Pages / Visit: 2.84
  • Avg. Duration: 00:04:22
  • Bounce Rate: 57.78%
  • % New visits: 68.89%

so basically increase the number of visits, unique visitors, pageviews of 10 , but leave the other options the same.

Http://jsfiddle.net examples are welcome

PS: sorry for my bad english (not my native language)

+6
source share
3 answers

Google Analytics defines timeOnPage and timeOnSite on the server side, the code is based on the time elapsed between the pages viewed. Since all this is done on the server side, there is no way to fake this unless you divide your pageviews by the amount of time you want to fake.

You also need to send more than 1 page to the tracker to get the correct number of pages / visit. Currently, every time you switch between two trackers, you reset the cookie, and the previous visitor is lost forever.

So you want to do something like this:

  • Create first tracker
  • Display Pageview
  • wait for something between 1 and 2 seconds.
  • Fire another page view
  • Perhaps start the third page after another 1 or 2 seconds in 80% of cases to get closer to the correct average.
  • Create a new tracker
  • repetition

I would say that you would probably want to introduce another randomness while maintaining the same average value. For example, in order to get the desired BounceRate, you will need to have 57% of visits that take a single pageview. And in order to get the desired rate of new visitors, you need to return with one of these old identifiers, but as part of a new visit, to call a new visitor. You can start a new visit by deleting cookies __utmb or __utmc or just waiting longer than 30 minutes between a new pageview.

As you can see, the closer you want to fake the numbers with the help of truth, the more difficult it can turn out.

Now it becomes impractical to live on one page of a script. Since this can take a couple of seconds, and you probably want to imitate these thousands of times. So it might be better to create this using a mute browser such as phantom.js so that you can run multiple simultaneous instances to get the desired results.

I wonder what kind of analysis you plan to extract from this. Depending on the type of analysis, what you already have is enough, or maybe an attempt to improve emulation is not worth understanding.

+1
source

You cannot do this on one web page. The problem is that whenever you reset the hash, it starts a new session, which will force the first "visitor" to leave, omitting avg. visit duration and increase bounce rate.

I believe that you could accomplish everything except the unique visitors requirement * 10 by doing the following:

  • Create a basic HTML page that has only the standard Google Analytics code, let's call it ga.htm .
  • Create an include file with an iFrames size of 9x0x, each with src ga.htm , we will call it include-ga.htm .
  • Include the include-ga.htm file at the bottom of all your pages.

This should artificially make GA think that the user is viewing 10 pages at once, which should multiply all your statistics in unison, with the exception of unique visitors.

+1
source

This is a proof of the concept that I am assuming.

Doesn't your code already prove that you can manipulate GA statistics, only a hint of manipulation is the average visit time.

What I found interesting was how GA determines if it is a unique visitor. You might think that google is checking some type of IP / Mac / hostname or secret unique identifier on the host. To help GA he points out

Unique visitors (or Absolute unique visitors): Unique visitors represent the number of non-multiplied (only for counting once) visitors to your site over a period of time. A unique visitor is determined using cookies.

Maybe your average Duration of visit: can be used in GA cookies. There is a jquery add-on / plugin that can be used to create cookies through a java script.

Is your project interested in success?

For completeness Google GA Help

0
source

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


All Articles