Google Analytics without Javascript


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $var_utmac=GOOGLE_ANALYTICS_CODE; //enter the new urchin code
  2. $var_utmhn=WEB_DOMAIN; //enter your domain
  3. $var_utmn=rand(1000000000,9999999999);//random request number
  4. $var_cookie=rand(10000000,99999999);//random cookie number
  5. $var_random=rand(1000000000,2147483647); //number under 2147483647
  6. $var_today=time(); //today
  7. $var_referer=$_SERVER['HTTP_REFERER']; //referer url
  8.  
  9. $var_uservar=$storeinfo["storeid"]; //enter your own user defined variable
  10. $var_utmp="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  11.  
  12. $urchinUrl='http://www.google-analytics.com/__utm.gif?utmwv=1&utmn='.$var_utmn.'&utmsr=-&utmsc=-&utmul=-&utmje=0&utmfl=-&utmdt=-&utmhn='.$var_utmhn.'&utmr='.$var_referer.'&utmp='.$var_utmp.'&utmac='.$var_utmac.'&utmcc=__utma%3D'.$var_cookie.'.'.$var_random.'.'.$var_today.'.'.$var_today.'.'.$var_today.'.2%3B%2B__utmb%3D'.$var_cookie.'%3B%2B__utmc%3D'.$var_cookie.'%3B%2B__utmz%3D'.$var_cookie.'.'.$var_today.'.2.2.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B__utmv%3D'.$var_cookie.'.'.$var_uservar.'%3B';
  13.  
  14. $handle = fopen ($urchinUrl, "r");
  15. $test = fgets($handle);
  16. fclose($handle);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.