Getting Started
Tracking Website Data
To begin tracking data on a website, simply cut and paste the tracking script onto your pages. You place the tracking script in the HEAD block of your
pages. You can get the tracking script from the
Setup / Projects menu item. For example:
<head>
place tracking script in HEAD block
</head>
The script can track
sessions,
pageviews and
events, depending on what you are interested in.
Script setup
The script has some setup code on top. Look for the following lines at the bottom of the script:
var gator = new Aggregator(your project id);
gator.logPageview();
You must make sure your project id is in the
project id parameter. The best way to do this is to get the script from the
Setup / Projects menu and cut and paste it onto your pages.
The part of the script that tracks a pageview is this:
gator.logPageview();
By default, this logs the current page, but you can track custom page names, if needed, by passing in a page name. For example:
gator.logPageview('mypagename.html');
To track an event, use the
gator.logEvent call. For example::
gator.logEvent('Purchase', { amount: 19.95 } );
For more details, see the topic on
Tracking Events.
Asynchronous loading
The tracking script never blocks. The script is loaded asynchronously and all commands are queued until the library is loaded. From a coding
point of view, you can utilize the full API, even offline, without having to account for blocking calls.