1

有没有办法从 Facebook 应用程序跟踪即时文章到谷歌分析?

为了清楚起见,我根据官方指南添加了一个代码:

<figure class="op-tracker"> <iframe> <!-- <script>
    (function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),                         m=s.getElementsByTagName(o)0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-173809-XX', 'auto');
    ga('require', 'displayfeatures');
    ga('set', 'campaignSource', 'Facebook');
    ga('set', 'campaignMedium', 'Social Instant Article');
    ga('send', 'pageview', {title: 'POST TITLE'});
</script> --> </iframe> </figure>

没啥事儿?

感谢您的任何建议

4

1 回答 1

0

您已将<script>标签注释掉。删除 html 注释 ( <!-- -->) 应该可以:

<figure class="op-tracker"> <iframe> <script>
(function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),                         m=s.getElementsByTagName(o)0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-173809-XX', 'auto');
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('send', 'pageview', {title: 'POST TITLE'});

于 2016-08-31T20:54:55.140 回答