我有下一个代码:
function get_pixel_tracking(){
$utm_source = $_GET['utm_source'];
$utm_medium = $_GET['utm_medium'];
$utm_campaign = $_GET['utm_campaign'];
$var_utmac = 'UA-XXXXXXXX-Y'; //enter the new urchin code
$var_utmhn = 'example.com'; //enter your domain
$var_utmn = rand(1000000000,9999999999); //random request number
$var_cookie = rand(10000000,99999999); //random cookie number
$var_random = rand(1000000000,2147483647); //number under 2147483647
$var_today = time(); //today
$var_utmp = '/page-gapx';
$urchinUrl = 'http://www.google-analytics.com/__utm.gif?utmwv=1&utmn='.$var_utmn.'&utmsr=-&utmsc=-&utmul=-&utmje=0&utmfl=-&utmdt=-&utmhn='.$var_utmhn.'&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'.$utm_campaign.'%7Cutmcsr%3D'.$utm_source.'%7Cutmcmd%3D'.$utm_medium.'%3B%2B__utmv%3D'.$var_cookie.'.%3B';
$im = file_get_contents($urchinUrl);
header('content-type: image/gif');
echo $im;
}
当我调用此函数时,谷歌分析正在跟踪,但谷歌分析中的位置国家始终是服务器位置而不是用户位置。
如何在 Google Analytics 中获取正确的位置(即国家、城市)?