How to get detailed link information from Google Analytics

    

      var _gaq = _gaq || [];
      _gaq.push (['_ setAccount', 'UA-xxxxxx-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);
      }) ();

    
  • Using the tools www.google.com/analytics for the website, I see how many visitors have visited. To my specific URL.

Now the question is:

I want to use PHP or Javascript to execute this query myself, to find this information and display it on my own page.

How can I get all pages from Google Analytics using my account? Please bring some tips and examples; I tried this, but it doesn’t work.

ex: http://gdata-jsguide.appspot.com/static/analytics/samples/retrievedatacontent.js

+3
source share
1 answer

: , , GA.

, , GA , .

- , _trackPageview() .

, .

-, , GA .

(__utm.gif):

http://www.google-analytics.com/__utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...

utmcc cookie GA. utmcc utma, Cookie-:

cookie , '.'

97315849.1774621898.1207701397.1207701397.1207701397.1

:

  • ()

  • ( ) ,

  • ( UNIX)

  • ( UNIX )

  • ( UNIX )

  • ( GA)

, GA, GA cookie, ; GA , .

utmaa cookie , . " ", , GA, . cookie .

- GA, , . , - , javascript, , , ( GA, ..). , :

// takes three parameters: l-> target string; n -> start pattern; s -> end pattern
// returns the visitor cookie (the entire cookie not just the second field)
function vID(l, n, s) {
  if (!l || l=="" || !n || n="" || !s || s="") return "-";
  var i, i2, i3, c="-";
  i=l.indexOf(n);
  i3=n.indexOf("=")+1;
  if (i > -1) {
    i2=l.indexOf(s, i);
      if (i2 < 0) {
        i2=l.length;
      }
      c=l.substring((i+i3), i2);
   }
      return c;
}

var q = vID(document.cookie, '__utma=', ';');

, - , ( , w/cookies).

+3

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


All Articles