0
我想添加事件追蹤到正在轉換爲HTML跨域產品...附加GA事件跟蹤,以JSON元素
該文件位於服務器端和PHP編寫的。 JSON的片斷,我需要追加GA事件如下:
"products": [
{
"title": "product",
"description": "description",
"thumbnail": "http://myurl.com/picture.jpg",
"price": "£1.99",
"url": "http://link.com"
},]
現在,讀了這篇文章對這個一點給了我一些真知灼見:Using google analytics to track hits on an XML web service
難道是這樣簡單的事嗎?
<?php
//Initilize GA Tracker
$tracker = new GoogleAnalytics\Tracker('UA-12345678-9', 'example.com');
?>
"products": [
{
"title": "product",
"description": "description",
"thumbnail": "http://myurl.com/picture.jpg",
"price": "£1.99",
"url": "http://link.com"
},$ga->setEvent("Category", "Action", "Label", "Value");]
「當然」,因爲在它的工作?這個JSON所投入的網站將在某個地方以
運行GA。 –你能解釋一下哪些方法無效嗎? – ins0
感謝您的回覆@ ins0 明天當我看到它進入分析時,我會盡快回復您。 整個目的是真的要問,如果語法工作,因爲我基本上把PHP放入JSON在我上面的例子。 –