如何向AMP analytics json属性添加多个社交值。
"vars": {
"socialNetwork": "twitter",
"socialAction": "tweet",
"socialTarget": "https://www.examplepetstore.com",
"socialNetwork": "facebook",
"socialAction": "share"
}
这就是我想到的,但我认为这是不正确的。 非常感谢!
答案 0 :(得分:1)
你可以这样做:
ADD JS
<script async custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
跟踪Twitter和Facebook的代码
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-XXXXX-Y"
},
"triggers": {
"trackClickOnTwitterLink" : {
"on": "click",
"selector": "#tweet-link",
"request": "social",
"vars": {
"socialNetwork": "twitter",
"socialAction": "tweet",
"socialTarget": "https://www.examplepetstore.com"
}
},
"trackClickOnFacebookLink" : {
"on": "click",
"selector": "#facebook-link",
"request": "social",
"vars": {
"socialNetwork": "facebook",
"socialAction": "facebook",
"socialTarget": "https://www.examplepetstore.com"
}
}
}
}
</script>
</amp-analytics>