Confluence with Google Analytics

I'll start with my apologize for creating so trivial tutorial. But even the most trivial tutorial can be helpful for someone. I myself have spent a while in searching for a way to accomplish this.

Acquiring Analytics ID

The first step is to get analytics ID for your Confluence website. You can get one at

Deploying Analytics Script

Once you've got analytics ID and analytics script you need to embed, you need to configure Confluence:

  1. Go to Confluence Administration, then select "Custom HTML" (under "Look and Feel" section);
  2. Click "Edit" button;
  3. Paste your Google Analytics script in "At end of the HEAD" field, like this:

  4. Click "Save".

Well, that's it!

Advanced Analytics

I must admit that I'm not Google Analytics expert, but I'm aware that the platform offers much more than simply tracking visitors (campaigns, etc.). I'm also aware that for advanced usage we need to do more than simply pasting basic Google Analytics script (we've done here). Here I won't go into details about that (as mentioned I'm not expert in the area), but I can tell you that any configuration, no matter how complex, can be accomplished by using two Confluence's features: Custom HTML and User Macros. When you know how these are working you'll be able to implement not only advanced Google Analytics (with different parameters on different pages, etc.), but also any client-side (JavaScript) feature.