Add Google Analytics to a Confluence Space
How to add Google Analytics to your Confluence space. You can track the traffic on your Confluence space by incorporating Google Analytics code on one or more pages of your space.
This article applies to: Confluence
When a page that has this code is viewed, a call is made to the Google Analytics server to store information about the visit. This information that is collected includes:
- The domain of the visitor’s IP address (e.g. cornell.edu)
- The visitor’s country
- The site that referred the visitor to your page (i.e. where did they click the link?)
- The url of the page that was visited
- Information about the browser the visitor used.
To obtain and implement the Google Analytics Tracking Code
Obtain the code
- Create a new account on the Google Analytics website. For this account, you need to provide a website URL (for example, http://confluence.cornell.edu) and an account name (for example, Confluence).
- Add a new profile for your account
- Select for a new domain
- Enter the URL for your space (e.g. https://confluence.cornell.edu/display/xxxxx, where xxxxx is the key for your space)
- Analytics will give you some javascript code that should be added to your space. You should copy/paste this code into a simple text document so that you have it for the future, as well as for pasting into your Confluence space.
Implement the Code
The following method is the easiest way to implement your Analytics code.
- Create a new page in your space titled “Google Analytics” to hold the tracking code.
- Using the wiki markup editor, add the following to that page:
{html}
javascript code copied from Google Analytics
{html} - Then, at the bottom of each page that you want Analytics to track, use the include page macro to include the Analytics tracking code page, using the name of your Google Analytics page. Place the following code at the bottom of the content on the page. For example: add {include:Google Analytics} to the bottom of your page.
- It will take up to 24 hours for your data to appear in Analytics.
There are other methods of adding Analytics to each page of your space. Some methods use the footers of certain themes (Adaptavist), and some methods use page templates. If you need additional help implementing Google Analytics in your space, email CIT Confluence support.
Support Contact:
Cornell IT Service Desk
Normal Business Hours: Monday-Friday, 8am-6pm (Eastern Time)
Emergency Service Disruptions: After Hours Support
Comments?
To share feedback about this page or request support, log in with your NetID