var CM_GoogleAnalyticsAccountList = ["UA-34097574-2","UA-70671327-1","UA-96779725-1"]; var CM_GoogleAnalyticsAsync = { setAccount: '_setAccount', trackPageview: '_trackPageview', Accounts: CM_GoogleAnalyticsAccountList, getIndexPrefix : function(i) { return i > 0 ? String.fromCharCode(97 + parseInt(i, 10)) + "." : ""; } }; function trackConversion(pageName, queryString) { for (var i = 0; i < CM_GoogleAnalyticsAsync.Accounts.length; i++) { _gaq.push([CM_GoogleAnalyticsAsync.getIndexPrefix(i) + CM_GoogleAnalyticsAsync.trackPageview, pageName+queryString]); } } function getGoogleAnalyticsCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } } var _gaq = _gaq || []; var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js'; var timeoutLength = 0; _gaq.push(['_require', 'inpage_linkid', pluginUrl]); if (window.googleAnalyticsCustomVariableFunctions) { for (var j = 0; j < window.googleAnalyticsCustomVariableFunctions.length; j++) { window.googleAnalyticsCustomVariableFunctions[j](); } } if ((window.useAutoNationGoogleAnalyticsCustomVarsOnPageLoad && (getGoogleAnalyticsCookie('__utma') === undefined || getGoogleAnalyticsCookie('__utma').length < 1)) || (window.useAutoNationGoogleAnalyticsCustomVarsOnPageLoad && (getGoogleAnalyticsCookie('__utmb') === undefined || getGoogleAnalyticsCookie('__utmb').length < 1))) { timeoutLength = 500; } setTimeout(function () { // Yes, this setTimeout is bad. But there is no way to hook into an event after google analytics creates the cookies. Sorry. for (var index = 0; index < CM_GoogleAnalyticsAsync.Accounts.length; index++) { _gaq.push([CM_GoogleAnalyticsAsync.getIndexPrefix(index) + CM_GoogleAnalyticsAsync.setAccount, CM_GoogleAnalyticsAsync.Accounts[index]]); if (!window.CM_GoogleAnalyticsAutoNationIpAddress) { window.CM_GoogleAnalyticsAutoNationIpAddress = ""; } if (index !== 0 && window.useAutoNationGoogleAnalyticsCustomVarsOnPageLoad) { _gaq.push([CM_GoogleAnalyticsAsync.getIndexPrefix(index) + '_setCustomVar', 13, 'Client Id', getGoogleAnalyticsCookie('__utma')], [CM_GoogleAnalyticsAsync.getIndexPrefix(index) + '_setCustomVar', 14, 'Session Id', getGoogleAnalyticsCookie('__utmb')], [CM_GoogleAnalyticsAsync.getIndexPrefix(index) + '_setCustomVar', 15, 'IP Address', window.CM_GoogleAnalyticsAutoNationIpAddress]); } if (index !== 0 && window.useAutoNationGoogleAnalyticsCustomVarsOnConfirmation) { _gaq.push([CM_GoogleAnalyticsAsync.getIndexPrefix(index) + '_setCustomVar', 20, 'Lead Id', $.url.param('cid')], [CM_GoogleAnalyticsAsync.getIndexPrefix(index) + '_setCustomVar', 21, 'Dealership Name', window.CM_GoogleAnalyticsAutoNationDealerName]); } _gaq.push([CM_GoogleAnalyticsAsync.getIndexPrefix(index) + CM_GoogleAnalyticsAsync.trackPageview]); } }, timeoutLength); (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); })();