这篇文章主要介绍GA中的MP协议,在GA中,社交互动可能是:
Facebook likes
Facebook unlikes
Twitter Tweets
Twitter Follows
Twitter Retweet
Twitter Clicks
Google +1s etc.
这些社交互动全部能跟踪到用户的点击次数和分享次数,社交互动在GA中有以下几种类型:
- socialNetwork – 发生社交行为的站点
- socialAction – 发生社交行为的动作
- 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协议发送社交互动数据,各个类型需要用到以下协议字段:
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
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
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