How does it work?
Analytics can provide you with important and interesting information about how your website is being used. The information is collected by means of small snippets of code that are added to the web pages.
Such snippets enable data to be collected and reports generated. The data collected depends on the provider and the code snippet used. Example statistics include:
- how many users visited your site over a period of time
- how many pages were visited
- search terms used to find your site
- landing pages and exit pages.
If you haven't set up your Google Analytics account, visit http://www.google.ca/analytics/
Once your Google Analytics account has been set up, create a Tracking Code. This Tracking Code is a script that contains an identifier, which AEM requires.
The script above is an example of a Tracking Code. The part highlighted in blue -
UA-18105214-1 - is the identifier. Find and copy the identifier in your Tracking Code.
After copying the identifier, sign into AEM and complete the following steps:
- Double-click your site's homepage to edit in the Editing Window.
- In the Sidekick, click on Page Properties...
- Click on the Advanced tab and expand the Google section.
- Insert the identifier into the Analytics ID field.
- If you are using Google's new Universal Analytics, check the Universal Analytics option.
- Click OK to save the changes. Your Google Analytics is now setup.
Note: In order to make all child pages inherit the analytics code, the Site Config page must be setup. However sub-sites will not inherit the analytics code.
Your site statistics will be viewable approximately 24 hours after set-up by logging into your analytics account.
Google Analytics registering unusual page views
Copying and pasting a URL from the authoring environment to the published site (typically for testing purposes) will result in Google Analytics registering a page view for that page. If you see a URL in your Google Analytics report with /content/sfu/, you can safely ignore these hits.
- Open your site's homepage in the Editing Window.
- Enter Inherited Content mode and insert a HTML Component into the top main content section.
- Click the EDIT button. The browser will open a new tab where you can paste the entire script, which should begin with "<script>" and end with "</script>". Click the SAVE button.
- Close the tab to go back to the Editing Window.
- Exit the Inherited Content mode from the Sidekick. The HTML component will not be visible after this step, unless you re-enter Inherited Content mode. To make it easier to discover which page contains the script in the future, we recommend adding an annotation to the page. Make a note explaining the page contains a tracking script in the Inherited Content section.
The analytics is now setup. Check the support page of your analytics provider to learn how long it'll take to start collecting site statistics.