<!-- Global site tag (gtag.js) - Google Analytics -->
<script type="text/javascript" src="/gtag/js?id=UA-188325670-1"></script>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('set', 'dimension1',“mytest”);
gtag('set', 'dimension2', document.referrer);
gtag('set', 'dimension3', document.URL);
gtag('set', 'dimension4', document.title);
gtag('js', new Date());
gtag('config', 'UA-188325673-1');
gtag('event', 'purchase', {
"transaction_id": "24.031608523954162",
"affiliation": "Google online store",
"value": 23.07,
"currency": "USD",
"tax": 1.24,
"shipping": 0,
"items": [
{
"id": "P12345",
"name": "Android Warhol T-Shirt",
"list_name": "Search Results",
"brand": "Google",
"category": "Apparel/T-Shirts",
"variant": "Black",
"list_position": 1,
"quantity": 2,
"price": '2.0'
},
{
"id": "P67890",
"name": "Flame challenge TShirt",
"list_name": "Search Results",
"brand": "MyBrand",
"category": "Apparel/T-Shirts",
"variant": "Red",
"list_position": 2,
"quantity": 1,
"price": '3.0'
}
]
});
</script>
然後在GA後臺的 自定義-》自定義維度裏面創建 dimention1=
dimention[n]=
並點擊啟用電子商務即可。