【问题标题】:Tracking marker clicks on Google Maps API - Analytics跟踪标记点击 Google Maps API - 分析
【发布时间】:2011-09-28 10:15:14
【问题描述】:

我正在尝试使用 Google Analytics(分析)跟踪点击地图标记的人数,这可能吗?如果可以,我有什么选择?

提前致谢!

【问题讨论】:

    标签: api google-maps google-analytics


    【解决方案1】:

    更新后的GA implementation如下:

    ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
    

    例子:

    google.maps.event.addListener(marker, 'click', function() {
        ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
        infoWindow.setContent(html);
        infoWindow.open(map, marker);
    });
    

    【讨论】:

      【解决方案2】:

      我不知道为什么没有更好的文档记录,但这是我最终如何让它工作的。将 gaq.push 添加到用于标记单击的 addListener 函数。请参阅 antyrat 链接的文档。

      google.maps.event.addListener(marker, 'click', function() {
          gaq.push(['_trackEvent', 'category', 'action', 'opt_label']);
          infoWindow.setContent(html);
          infoWindow.open(map, marker); 
      }); 
      

      【讨论】:

        【解决方案3】:

        您可以使用 Google Analytics 中的 Event Tracking 功能执行此操作。有关跟踪系统的更多信息,您可以在官方documentation找到。

        【讨论】:

          猜你喜欢
          • 2012-03-24
          • 1970-01-01
          • 2012-08-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-12-22
          • 1970-01-01
          • 2017-10-20
          相关资源
          最近更新 更多