var _gaq = _gaq || ; _gaq.push(['_setAccount', 'UA-XXXXXX-X']); _gaq.push(['_trackPageview']);
To set up this re-direct:
Let’s pretend we’re setting up yoursite.com/awesome.
- Create a directory in the site’s root called awesome.
- Create a new file in your new directory. You can use whatever file extension you want. We usually go with default.aspx or index.html.
- Note: Double check the default document in IIS on your directory. Make sure it’s set to whatever document you created. This allows yoursite.com/awesome to work without specifying the document.
- Edit the file:
- Change the title tag if you like
- Change the Google Analytics ID to match yours
- Set the category, action, and label that you want to call the event
- Change the URL to whatever you want it to go to
- Navigate to yoursite.com/awesome and verify it’s working.
- The data will show up in event tracking in Google, and will not increment your regular page views.
That’s pretty much it. Since the Google JS calls are asynchronous, we add a little delay to force the tracking to increment before the page redirects.
This redirect method is useful only if you plan to track these redirects as events; if not, it’s easier to set them up in IIS alone.