我正在尝试使用jQuery查找页面上的所有链接,然后在点击它们时使用Google Analytics跟踪事件.
我有链接部分工作,我只是没有看到跟踪工作事件激发(使用httpfox监控时).
谁能看到我做错了什么?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery and GA</title>
<!-- This Jquery reference is already on the page -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- This script block should go anywhere on the page, ideally the head, or really ideally in the a master scripts file -->
<script>
$(document).ready(function() {
// Each time a link is clicked, this function gets called
$('a').click(function(){
// Get the url
var url = this.href; …Run Code Online (Sandbox Code Playgroud)