javascript 跟踪Socrata跟踪器按钮点击的示例代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 跟踪Socrata跟踪器按钮点击的示例代码相关的知识,希望对你有一定的参考价值。

//assuming jQuery is available

//attach events to the nav buttons above datasets
$('#sidebarOptions').on('click', 'a', function() {
  var dataset = $('#datasetName').attr('title');
  var label = $(this).attr('title');
  //labels sent to google analytics on click events will include the dataset name and the label of the button
  //this gives greater insight into how users are interacting with datasets once they arrive
  ga('send', 'event', 'Data Panel', 'Click', dataset + ': ' + label);
});

$('.downloadsList').on('click', 'a', function() {
  var dataset = $('#datasetName').attr('title');
  var label = $(this).attr('data-type');
  //labels sent to google analytics on click events will include the dataset name and the type of download file
  //this gives greater insight into how users are interacting with datasets once they arrive
  ga('send', 'event', 'Download', 'Click', dataset + ': ' + label);
});

以上是关于javascript 跟踪Socrata跟踪器按钮点击的示例代码的主要内容,如果未能解决你的问题,请参考以下文章

跟踪 Javascript 代码的最佳方法 [关闭]

如何在黄瓜中跟踪来自javascript的重定向?

javascript 如何使用jQuery通过Google Universal Analytics跟踪电话号码和按钮点击等自定义事件。

跟踪用户点击浏览器上的后退按钮的时间

如何使用 Javascript 跟踪 AdWords 转化?

如何将事件跟踪添加到 Javascript 警报