这篇文章主要介绍GA中的MP协议,在GA中,社交互动可能是:

Facebook likes
Facebook unlikes
Twitter Tweets
Twitter Follows
Twitter Retweet
Twitter Clicks
Google +1s etc.

          这些社交互动全部能跟踪到用户的点击次数和分享次数,社交互动在GA中有以下几种类型:
#1 socialNetwork – 发生社交行为的站点
#2 socialAction – 发生社交行为的动作
#3 socialTarget – 行为多对应的URL


‘socialNetwork’ 可以是以下值:

Twitter
Facebook
LinkedIn
Disqus
Stack Overflow
Google+
Pocket
it
Quora
Netvibes etc

‘socialAction’ 可以是以下;

like
unlike
click
tweet
+ 1
follow
retweet etc

     为了通过MP协议发送社交互动数据,各个类型需要用到以下协议字段:


#1 Social Action
Social Action被缩写成‘sa’,值是字符型,如:

sa=like

完成的就是:

v=1&t=social&tid=UA-1500844-34&cid=4bae429a-8589-4d89-91d9-c3f45f2b58e2&sa=like
&sn=facebook&st=https%3A%2F%2Fwww.optimizesmart.com%2Fanalytics-consultation%2F

#2 Social Network
Social Network被缩写成‘sn’,值是字符型,如:

sn=Facebook

完成的就是:

v=1&t=social&tid=UA-1500844-34&cid=4bae429a-8589-4d89-91d9-c3f45f2b58e2&
sa=like&sn=facebook&st=https%3A%2F%2Fwww.optimizesmart.com%2Fanalytics-consultation%2F

#3 Social Target
Social Target被缩写成‘st’,至是url,如:

st=https%3A%2F%2Fwww.optimizesmart.com%2Fanalytics-consultation%2F

完成就是:

v=1&t=social&tid=UA-1500844-34&cid=4bae429a-8589-4d89-91d9-c3f45f2b58e2&sa=like&
sn=facebook&st=https%3A%2F%2Fwww.optimizesmart.com%2Fanalytics-consultation%2F

当你构造完要发送的数据后,还需要组装成如下才能向GA服务器发送

User-Agent: user_agent_string
POST https://www.google-analytics.com/collect?payload_data

For example:
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36
POST https://www.google-analytics.com/collect?v=1&t=social&tid=UA-1500844-34&
cid=4bae429a-8589-4d89-91d9-c3f45f2b58e2&sa=like&sn=facebook&
st=https%3A%2F%2Fwww.optimizesmart.com%2Fanalytics-consultation%2F

 

原文链接:https://www.optimizesmart.com/sending-social-interactions-via-measurement-protocol-google-analytics/

 

版权声明:除非注明,本博客均为GA小站的原创文章,转载或引用请以超链接形式标明本文地址,请尊重版权,谢谢合作!(作者QQ:823138318)