谷歌分析如何使用及工作原理
<!-- Global site tag (gtag.js) - Google Analytics -->
<script type= text/javascript src= https://www.googletagmanager.com/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]=
并点击启用电子商务即可。