对于一些刚刚起步的电商网站,数据分析是非常重要的,帮助运营人员统计数据,使用google analysis非常有用。
一 以下是Google AdWords对网站上一些重要操作事件的跟踪代码,
为了让跟踪功能正常工作,您需要确认同时包含此代码段和相应的“onClick”代码(可在我们提供的示例中找到)。这样就会通知 AdWords 仅在用户点击特定按钮、链接或图片时才会记录转化。如果您在 HTML 中未放置“onClick”代码,则不会记录任何转化。
如需示例,请参阅 https://support.google.com/adwords/answer/6331304?&hl=zh_CN。
跟踪的事件或者页面加载如下:
1、下面是用于跟踪“1 Send Message”转化操作的 Google AdWords 转化跟踪代码。
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
/*
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = 865528640;
w.google_conversion_label = "1uYFCMWv_XIQwNbbnAM";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
src="//www.googleadservices.com/pagead/conversion_async.js">
2、下面是用于跟踪“2 Log In”转化操作的 Google AdWords 转化跟踪代码。
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
/*
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = 865528640;
w.google_conversion_label = "UUvECJL45HIQwNbbnAM";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
src="//www.googleadservices.com/pagead/conversion_async.js">
3、下面是用于跟踪“3 Add to Cart”转化操作的 Google AdWords 转化跟踪代码。
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
/*
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = 865528640;
w.google_conversion_label = "wllMCNqv_XIQwNbbnAM";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
src="//www.googleadservices.com/pagead/conversion_async.js">
4、下面是用于跟踪“4 Check out”转化操作的 Google AdWords 转化跟踪代码。
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
/*
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = 865528640;
w.google_conversion_label = "O1nBCPTM9nIQwNbbnAM";
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
/* ]]> */
src="//www.googleadservices.com/pagead/conversion_async.js">
5、以下是适用于转化操作5 Purchase的Google AdWords转化跟踪代码。
/*
var google_conversion_id = 865528640;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "KE7cCI_N9nIQwNbbnAM";
var google_remarketing_only = false;
/* ]]> */
二 以下是Google Analytics的跟踪代码
网站跟踪
这是针对此媒体资源的 Universal Analytics 跟踪代码。
要充分发挥 Universal Analytics 为此媒体资源带来的优势,请将此代码复制并粘贴到您要跟踪的每个网页中。
(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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-102346997-1', 'auto');
ga('send', 'pageview');
如贵公司网站上已经有Google Analytics代码,可以借鉴下面的形式同时安装2个代码且不导致代码之间存在冲突,谢谢。
(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-75828740-1', 'auto');
ga('send', 'pageview');
ga('create', 'UA-86522558-1', {'name':'b'});
ga('b.send', 'pageview');
ga('create', 'UA-86223543-1', {'name':'c'});
ga('c.send', 'pageview');
网友评论