我尝试在ajax请求中跟踪目标,但它无效。这是我的代码:
$.ajax({
type: "GET",
url: "https://domain.com",
dataType: 'jsonp',
crossDomain: true,
data: $("#registrationForm").serialize(),
success: function(data)
{
if(data.message == "ok") {
if(data.subscription == 16801 || data.subscription == 17001) {
if(data.subscription == 16801) {
var url = "/product/premium";
} else {
var url = "/product/basic";
}
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XX-XXXXXX-X']);
_gaq.push(['_trackPageview', url]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
}
}
});
知道我做错了什么吗?除了设定目标外,该脚本工作正常。
提前致谢。