Skip to main content

Cornell University

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

On This Page

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.
  • 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

  1. Create a new account on the Google Analytics website.  For this account, you need to provide a website URL (for example, and an account name (for example, Confluence).
  2. Add a new profile for your account
    1. Select Add a Profile for a new domain
    2. Enter the URL for your space (e.g., where xxxxx is the key for your space)
  3. 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.

  1. Create a new page in your space titled “Google Analytics” to hold the tracking code.
  2. Using the wiki markup editor, add the following to that page:
    javascript code copied from Google Analytics
  3. 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.
  4. 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


To share feedback about this page or request support, log in with your NetID

At Cornell we value your privacy. To view
our university's privacy practices, including
information use and third parties, visit University Privacy.