【问题标题】:pinterest social tracking with google analytics使用谷歌分析进行 pinterest 社交跟踪
【发布时间】:2014-05-23 05:45:22
【问题描述】:

我需要在谷歌分析中跟踪一个 pinterest 按钮。第一个代码适用于在封装在 pin div 中的 pinterest 按钮代码之后隐含的 html 网站。我正在尝试将它应用于下面的第二个代码,它是一系列社交媒体按钮的一部分。但是我无法让它工作。任何帮助,将不胜感激。 我在我的手机上。稍后我会发布完整的代码,只是想把它扔在那里。

    <div class="pin"><a href="http://pinterest.com/pin/create/button/?url=http://www.myurl.com/testingjava.html" class="pin-it-button">Pin It</a></div>

        <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
        <script>
        $(document).ready(function() {
                $('div.pin').click(function() {
                     _gaq.push(['_trackSocial', 'Pinterest', 'pin', $(location).attr('href')]);
                });
        });
        </script>



    'script' => '
    <div class="pin"><a href="http://pinterest.com/pin/create/button/?url=###URL###"        class="pin-it-button" count-layout="###layout###">Pin It</a></div>

    <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js">           </script>
    <script type="text/javascript"> 
     $(document).ready(function() {
        $(\'div.pin\').click(function() {
            _gaq.push([\'_trackSocial\', \'Pinterest\', \'pin\', $(location).attr(\'href\')]);
            });
    }); 
    </script>',

【问题讨论】:

  • 这是我在插件中使用但不起作用的完整代码。

标签: google-analytics pinterest


【解决方案1】:

开始脚本标签没有关闭:

 <script type="text/javascript">
 $(document).ready(function() {
    $(\'div.pin\').click(function() {
        _gaq.push([\'_trackSocial\', \'Pinterest\', \'pin\', $(location).attr(\'href\')]);
        });
}); 
</script>',

【讨论】:

  • 当我把它放在这里时,这只是一个错误的输入。它对我所有的实现都关闭了。
  • 如果改变任何东西,它就在一个 php 插件中
  • 这也是我感兴趣的。我在 Facebook、Google+ 和 Twitter 上做过,但从来没有用过 Pinterest。有一些插件可以提供帮助,但如果你有静态 HTML 或一些自定义系统,你需要在工具箱中使用这个技巧。
【解决方案2】:

我写了一封tutorial or at least an explination,讲述了我如何使用 Google Analytics 在旧的 HTML 页面上跟踪 Pinterest、Google+、Facebook 和 Twitter,我在我最喜欢的报价混搭中使用了相同的基本技术,甚至在我当前雇主的最新活动页面。

基本上jQuery是用来添加事件的,这不是一种技术,其他人首先想到的,但是让所有四个一起工作是更多的工作,加上我做了适当的结构化元数据等等等等。

【讨论】:

    猜你喜欢
    • 2014-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-06
    相关资源
    最近更新 更多