We love feedback

Please note: this is not a support channel. If you have an issue that requires assistance please visit the contact page.



Knowledge Base

How do I use Custom Tags?

Custom tags allows you for the first time to associate custom data with a page view on your website beyond what StatCounter records as standard, to help give you new insights into your traffic. For example your website may have a user login system, and you may want to tag a page view with the username of the visitor loading the page. Or you may want to have custom variables associated with a page view to help with split testing. Effectively you can now tag and segment your traffic in whatever way you wish!

Adding tags to a page

Tags are pairs of names and values. For example you may have a tag with the name ‘userType’ and various possible values e.g. ‘admin’, ‘senior’, ‘junior’

You can add tags for StatCounter to record by adding some additional javascript code anywhere
in your page before the standard StatCounter code, as in this sample:

<script type="text/javascript">
var _statcounter = _statcounter || [];
_statcounter.push({"tags": {"userID": "john", "userType": "senior", "category": "media"}});

Note: The above is just a sample - the tags object can contain any name/value pairs you like!

The _statcounter object is used to record tags that will be passed to the servers with the rest
of the standard page view data. You push a single javascript object, with a property ‘tags’. This property should itself be a Javascript object containing the tags you wish to associate with the page - in the above example the userID ‘john’, the userType ‘senior’ and the category ‘media’. Substitute in whatever tags are useful to you. The names and values for your tags are entirely up to you, and can be hard-coded or dynamically generated in your own scripting. You can add a variable number of tags up to a maximum of five per page, and you can have different tags on different pages. Every tag name must be associated with a tag value, and both are limited to a maximum of 30 characters each. The push function call can be made only once, so be sure to include all the tags you want in one go.

That’s it! Complete these edits and upload them to your website.


When viewing various StatCounter reports, including Recent Pageload Activity, Recent Visitor Activity or when magnifying users, you should now see an extra column for ‘tags’, showing you any tags associated with the page views.

In the case of Recent Visitor Activity, tags that have a consistent value across all page views in a visit will be associated with the visitor. For example, if all page views made by a particular visitor were tagged with the same user ID, the user ID will be shown as a tag for that visitor.

You will also find your custom tags added to the filter options on several StatCounter reports alongside the standard filter options. This will give you the flexibility to filter and segment your log based on custom tag values.

Custom Tag Report

The new Custom Tag report gives you a summary of tag data recorded in your log. For each tag type, it will show you a breakdown of the values recorded for that tag, and the percentage of page views in your log tagged with each value. You can click a value to get a further breakdown of the top 5 URLs recording that tag value.

This report is designed to give you an easy way to see how your traffic is divided between different tag values. For example, if you record a ‘logged-in’ tag, that is true if the visitor is signed in and false otherwise, you could quickly see the percentage of traffic on your site generated by logged in users vs anonymous users. And you could see which pages on your site are most popular with signed-in users alone. Or if you’re trying to optimise your site with split testing, you could tag a goal page with variables describing the content seen by that visitor, allowing you to easily segment converting traffic by whatever criteria you need.

Answers to the majority of questions we receive can be found here in the knowledge base.