阅读此文档后:https ://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#enhancedecom
我正在尝试像这样将数据发送到谷歌分析:
$data = array(
"v" => 1,
"tid" => "XX-xxxxx-x",
"cid" => "999",
"t" => "pageview",
"dh" => "mydemo.com",
"dp" => "/receipt10",
"dt" => "Receipt%20Page10",
"ti" => "T12367",
"ta" => "Google%20Store%20-%20Online",
"tr" => 40.39,
"tt" => 2.85,
"ts" => 5.34,
"pa"=>"purshase",
"tcc" => "SUMMER2013",
"pr1id" => "P1265445",
"pr1nm" => "Android%20Warhol%20T-Shirt 2",
"pr1ca" => "Apparel",
"pr1br" => "Google",
"pr1va" => "Black",
"pr1ps" => 2);
$content = http_build_query($data);
$content = utf8_encode($content);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://ssl.google-analytics.com/collect");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, utf8_encode($content));
//curl_setopt($ch,CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
这是部分工作:我在实时视图中获得了成功,我可以在“所有页面”视图中看到该页面,但在电子商务视图中什么也看不到。
我错过了什么?