text JS:GA事件跟踪
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text JS:GA事件跟踪相关的知识,希望对你有一定的参考价值。
//GOOGLE EVENTS TRACKING
var track = function(category, name, value) {
// console.log(category);
// console.log(name);
// console.log(value);
// return;
if (window._gaq) {
window._gaq.push(["_trackEvent", category, name, value]);
}
};
$(document).ready(function(){
$(document).on("click", "#branding .more", function(){ //Branding area more links
var ad = $(this).attr("title");
var spot = window.location.href;
var gaLabel = $(this).siblings('.sfitemTitle').text().trim();
track('Branding Area', 'More Link', gaLabel);
}).on("click", "#branding .slide:first-child a", function(){ //Branding Area first slide
var ad = $(this).attr("title");
var spot = window.location.href;
track('Branding Area', 'Apply Today', 'The first apply today branding image');
}).on("click", ".header .login a", function(){ //Header utility login link
var ad = $(this).attr("title");
var spot = window.location.href;
track('Header', 'Login Link', 'Header utility login link');
}).on("click", ".featured .btn", function(){ //Featured Buttons
var ad = $(this).attr("title");
var spot = window.location.href;
var gaLabel = $(this).text().trim();
track('Featured Area', 'Button Link', gaLabel);
}).on("click", ".loginBox a", function(){ //LoginBox on homepage
var ad = $(this).attr("title");
var spot = window.location.href;
var gaLabel = $(this).text().trim();
track('Login Box', 'Button Link', gaLabel);
});
});
以上是关于text JS:GA事件跟踪的主要内容,如果未能解决你的问题,请参考以下文章
GA 跟踪事件说明
ga 或 _gaq.push 用于 Google Analytics 事件跟踪?
javascript 测试GA表单/事件跟踪
javascript GA-跟踪helper.js
当我在本地主机中删除谷歌分析时,如何忽略整个网站的 ga() 事件跟踪代码?
javascript 用于返回Google Analytics的自定义事件跟踪器的功能,如果未针对本地/演示环境设置GA,则将其包装