javascript Google Analytics跟踪表单交互

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Google Analytics跟踪表单交互相关的知识,希望对你有一定的参考价值。

(function($){
	var forms = $("form");

	forms.on("submit", function(){
		var form = $(this);

		ga("send", "event", "forms",
			form.attr("name") || form.attr("id"),
			"submit";
		);	
	});

	forms.find(":input").on("change", function(){
		var form  = $(this).closest("form");

		ga("send", "event", "forms",
			form.attr("name") || form.attr("id"),
			(this.name || this.id) + "(change)";
		);
	});

	forms.find(":button").on("mousedown", function(){
		var form  = $(this).closest("form");

		ga("send", "event", "forms",
			form.attr("name") || form.attr("id"),
			(this.name || this.id) + "(click)";
		);
	});
})(jQuery);

以上是关于javascript Google Analytics跟踪表单交互的主要内容,如果未能解决你的问题,请参考以下文章

Javascript - GA 和 Adwords

整合谷歌分析功能

javascript Javascript:Google Analytics Snipper + Google Analytics JS日志记录

Google 跟踪代码管理器使用沙盒 JavaScript?

javascript Google Analytics事件跟踪Javascript

javascript [userscript] [Google]修复Google搜索标签的顺序