Use correct New Array syntax around custom page view tracking in Google Analytics
If you are using Google Analytics on your site, and you have code that tracks custom pages, events, etc., take care when placing your square brackets (ie. New Array syntax) around parameters:
INCORRECT
_gaq.push(['_trackPageview'], '/mycustompage.htm');
CORRECT
_gaq.push(['_trackPageview', '/mycustompage.htm']);
Incorrectly placing the square brackets is a common error and will fail silently due to the nature of how Google's Analytics JS library is dynamically inserted into the document.
Written by Shawn Holmes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#