Modified on: Thu, 18 Nov, 2021 at 4:22 PM
This article covers:
- Getting your version of the script
- Adding the code manually
- Configuring CSP rules
- Add the code in your CMS
Reach out to Siteimprove technical support if you have any questions regarding the code.
Getting your version of the script
You can find your version of the Siteimprove Analytics script from the left-had menu.
Go to Analytics > Analytics Settings > Tracking > Analytics Script.
Note: The 'XXXXX' in the code below represents a numeric code that is specific to your account so Do Not use this exact code below.
<script async src="https://siteimproveanalytics.com/js/siteanalyze_xxxxx.js"></script>
Adding the code manually
If you are able to access the HTML of your website or your Content Management System has a field specifically for adding tracking code you will be able add the Siteimprove Analytics code to your site.
Configuring CSP rules
If you're using Content Security Policy (CSP) you need to add rules to make sure that data collection works correctly.
Allowing the tracking script
Your account specific tracking script should be added to your allow list. This can be done by extending the script-src rule to include siteimproveanalytics.com. If you want to be even more restrictive, you can change the inclusion to include,
As an example, consider the existing CSP rule for a website:
Now if we add our rule it will look like this:
script-src: 'self' siteimproveanalytics.com;
Allowing the data delivery
Your account specific tracking script delivers data back to our collectors. This is done by loading a pixel, which essentially is a very small 1x1 image. Therefore, your CSP needs to allow loading our pixel images. This can be done by extending the img-src rule to include *.siteimproveanalytics.io.
To be even more restrictive, you can change the inclusion to include,
You have the possibility to add even more restrictive rules, however, this can result in data not being collected if you change some collection configurations.
As an example, consider the existing CSP rule for some website:
Now we add our rule and then the rule ends ups looking like:
img-src: 'self' *.siteimproveanalytics.io;
Add the code in your CMS
In this instance, you will want to find the file for the footer of your website (in WordPress that is footer.php for example) and place the code above the closing body-tag, </body>
Have your website/CMS provider add it
There can be a cost associated with this so be sure to inquire about fees with your website provider.
Add code through a Tag Manager
Important: Please ensure that the Siteimprove Analytics script is configured to load asynchronous in your Tag Manager.
If we use Google Tag Manager as an example you will want to paste the Tag Manager script on your site first. Once that is done you need to log in to the Tag Manager account and create a new Custom HTML Tag.
In 'Advanced Settings' change 'Tag firing options' to 'Unlimited' (2).
Finally, chose triggering that includes firing script on DOM/page load, like: 'DOM Ready', 'Page View' or 'Window Loaded' (3).
Siteimprove Academy Analytics courses
- Using Siteimprove Analytics
- Overview & Live Analytics
- Key Metrics
- Visitors and Content
- Entries & Exits and Traffic Sources
Reach out to Siteimprove technical support if you have any questions.
Did you find it helpful?Send feedback