All configuration parameters for this extension should be in your template TypoScript, inside the page.config.tx_m1_google_analytics container. Please see the option descriptions below.
Defines your Google Analytics account number. This parameter needs to be set for the extension to work. If your account number is UA-123456-7, your TypoScript in the template should look like:
page {
config.tx_m1_google_analytics {
account = UA-123456-7
}
}
Once you set up this parameter, you can check if everything worked correctly by looking at your pages HTML source. The piece of code that drives Google Analytics is inserted right before the closing tag of <body> container:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-123456-7";
urchinTracker();
</script>
</body>
One of nice features of Google Analyitcs is downloads tracking. What that means is that you can collect the statistics not only on the HTML pages viewed by a visitor, but also on the file downloads. This way, if you have PDF or Word files in your /fileadmin folder, downloads of these files will be counted as page views. To enable this function, set trackDownloadsFrom to the list of top-level directories on your website where you have files that might be linked to. For example, to enable tracking downloads from your /fileadmin and ./uploads folders, you would use this configuration:
page {
config.tx_m1_google_analytics {
account = UA-123456-7
trackDownloadsFrom = fileadmin,uploads
}
}
Another feature of Google Analytics is external (outbound) link tracking. This feature tells you where did the user go if they clicked an outbound link and left your website. To enable this feature, set trackExternalPrefix to a non-empty value, for example, “.external”. This value will be used as a “prefix” for pseudo-URLs in your statistics.
For example, if you set trackExternalPrefix to “.external” like this:
page {
config.tx_m1_google_analytics {
account = UA-123456-7
trackExternalPrefix = .external
}
}
and a user clicks a link to http://www.google.com, this click will be recorded in my statistics as a visit to /.external/http/www.google.com which will also be marked as a point of exit.
You can also override any default parameter in http://www.google-analytics.com/urchin.js by setting a value to any key in options container. For example, to override the _udn parameter, you would do this:
page {
config.tx_m1_google_analytics {
account = UA-123456-7
options {
_udn = auto
}
}
}
Below is a list of options available. For a full list of available parameters, download http://www.google-analytics.com/urchin.js . If a particular parameter you need to override is not in this table, the override will still work – the extension is looking for all sub-keys to options container and then just passes them into the JavaScript code.
parameter | Note | default |
|---|---|---|
_ufsc | client info flag (1=on|0=off) | 1 |
_udn | domain name for cookies (auto|none|domain) | auto |
_uhash | unique domain hash for cookies (on|off) | on |
_utimeout | inactive session timeout in seconds | 1800 |
_ugifpath | web path to the __utm.gif file | /__utm.gif |
_utsp | transaction field separator | | |
_uflash | flash version detect option (1=on|0=off) | 1 |
_utitle | document title detect option (1=on|0=off) | 1 |
_ulink | enable linker functionality (1=on|0=off) | 0 |
_uanchor | enable use of anchors for campaign (1=on|0=off) | 0 |
parameter | Note | default |
|---|---|---|
_uctm | campaign tracking module (1=on|0=off) | 1 |
_ucto | timeout in seconds (6 month default) | 15768000 |
_uccn | campaign name | utm_campaign |
_ucmd | medium (cpc|cpm|link|email|organic) | utm_medium |
_ucsr | source | utm_source |
_uctr | term/keyword | utm_term |
_ucct | content | utm_content |
_ucid | id number | utm_id |
Prior to version 1.5 the extension used a different set of configuration options. All these options were under page.config.googleAnalytics_* (for example, page.config.googleAnalytics_account). Version 1.5 is backwards-compatible and all legacy configuration options are still supported. However, when building new templates, the new configuration semantics is preferred and that's why I am removing the legacy options descriptions from the documentation.