今天,我要告訴你如何在Google Analytics(分析追踪Twitter的社交互動(鳴叫,點擊和跟隨).
第一先到twitter的官網安裝插件https://about.twitter.com/resources/buttons,然後把twitter的代碼複製下來貼到你的網站上每一頁.
注意一點就是以下這段連結twitter的圖檔的代碼就看你要放網頁哪邊容易讓消費者跟隨
<a href="https://twitter.com/xxxxxxx" class="twitter-follow-button" data-show-count="false" data-lang="zh-tw" data-size="large">跟隨 @xxxxxxx</a>
下面這段就必須放在</head>裡面
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);</script>
第二再把以下的跟蹤代碼複製下來貼到你的網站上每一頁,這樣子就大功告成了.
<script>
// Define Call Back Functions
function clickEventToAnalytics() {
ga(‘send’, ‘social’, ‘Twitter’, ‘Click’, window.location.href);
}
function tweetIntentToAnalytics() {
ga(‘send’, ‘social’, ‘Twitter’, ‘Tweet’, window.location.href);
}
function retweetIntentToAnalytics() {
ga(‘send’, ‘social’, ‘Twitter’, ‘Retweet’, window.location.href);
}
function followIntentToAnalytics() {
ga(‘send’, ‘social’, ‘Twitter’, ‘Follow’, window.location.href);
}
// Bind Twitter events to Call Back Functions
if (typeof twttr !== ‘undefined’) {
twttr.ready(function (twttr) {
twttr.events.bind(‘click’, clickEventToAnalytics);
twttr.events.bind(‘tweet’, tweetIntentToAnalytics);
twttr.events.bind(‘retweet’, retweetIntentToAnalytics);
twttr.events.bind(‘follow’, followIntentToAnalytics);
});
}
</script>
接下來就可以到google analytics裡去看數據了