The old post referenced the traditional/syncronous version of the Google Analytics tracking code. This new post features the newest release by Google, which is the asynchronous code execution.
Please note that I am not going to re-do the entire post, just the code portion.
So here is the code update:
Traditional Snippet (Synchronous):
function validate()
{
isEntered(document.getElementById('name'),'name');
isEntered(document.getElementById('email'),'email');
isEntered(document.getElementById('phone'),'phone');
isEntered(document.getElementById('company'),'company');
isEntered(document.getElementById('comments'),'comments');
frm.action='/thankyou.aspx?src=contact_us.htm';
}
function isEntered(el, field_name)
{
if((el.value=="") || (el.value==null))
{
pageTracker._trackPageview('/contact_us.htm/empty/'+field_name);
}
else
{
return false;
}
} Asynchronous Snippet (NEW):
function validate()
{
isEntered(document.getElementById('name'),'name');
isEntered(document.getElementById('email'),'email');
isEntered(document.getElementById('phone'),'phone');
isEntered(document.getElementById('company'),'company');
isEntered(document.getElementById('comments'),'comments');
frm.action='/thankyou.aspx?src=contact_us.htm';
}
function isEntered(el, field_name)
{
if((el.value=="") || (el.value==null))
{
_gaq.push(['_trackPageview', '/contact_us.htm/empty/'+field_name]);
}
else
{
return false;
}
}
Related Posts:
Overview Google Tag Manager (GTM) has introduced a powerful enhancement: the ability to retrieve Client…
If you’ve ever stared at a Google Analytics dashboard wondering where to start, or wished…
One of the first decisions a new Amplitude client must make is how to ingest…
This website uses cookies.