Adding Siteimprove Analytics JavaScript to your website
In order to use Analytics (or Traffic) on your website, you will need to add the Siteimprove Analytics JavaScript code. The code will be sent once you subscribe or request a trial for Analytics. (For information on adding a site see: How do I add a site to my Siteimprove subscription?) The code can also be found in the platform when you select a site using the Analytics site selector, that has an Analytics subscription but does not have the code.
This article covers:
- Getting your version of the script
- Adding the code manually
- Configuring CSP rules
- Add the code in your CMS
- Siteimprove Frontier Analytics courses
Reach out to Siteimprove technical support if you have any questions regarding the code.
Getting your version of the script
Note: Only Administrators and Account owners have access to the Analytics Script page in the platform.
For customers subscribed to Analytics
You can find your version of the Siteimprove Analytics script on the Analytics Script page on the platform (Requires login).
To navigate to the page go to Analytics > Analytics Settings > Tracking > Analytics Script from the left-hand menu.
Example of Siteimprove Analytics JavaScript code:
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>
You can use this same Analytics JavaScript code no matter how many websites you are tracking with Siteimprove Analytics. The code will need to be added to all pages that you want to track.
The Siteimprove Analytics JavaScript is asynchronous which means it will not affect your website’s performance, can work seamlessly with other JavaScript, and is not required to be placed in a specific location on your website.
Note: We recommend that the JavaScript is always added at the bottom of the website in a footer or similar, just before the closing HTML body tag. Also, JavaScript can be blocked by a content security policy (CSP) configured to prevent unwanted cross-site-scripting. If you use CSP, please configure it to allow the Siteimprove script.
It is likely you will need to take one of the following approaches in order to get the Siteimprove Analytics JavaScript on your site.
For customers not subscribed to Analytics (i.e. Traffic)
Customers not subscribed to Analytics can still take advantage of our Traffic features. You can find your version of the Siteimprove Analytics script on the Traffic data providers page on the platform (Requires login).
To navigate to the page go to Settings > Content > Traffic data providers from the left-hand menu.
Click on the button "Get script" and copy the code from the pop-up.
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.
It is recommended that you place the Siteimprove Analytics JavaScript on every page of your website just above the closing body-tag which looks like this </body>
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,
https://siteimproveanalytics.com
As an example, consider the existing CSP rule for a website:
script-src: 'self';
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,
https://*.siteimproveanalytics.io
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:
img-src: 'self';
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
In some cases, you will not have access to include files like your footer. If this is your situation you will need to contact your content management system provider and request that they insert the JavaScript on your behalf. The JavaScript should still be inserted just above the closing body tag, </body>.
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
If you utilize a tag management service like Google Tag Manager you can still utilize Siteimprove Analytics by adding the Analytics JavaScript through the tag manager. Be sure to follow the instructions for your tag management tool of choice to install it correctly.
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.
Next, add the JavaScript (1).
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).
See also: Loading Siteimprove Analytics code using Adobe launch
Siteimprove Analytics courses
Siteimprove Frontier offers scalable learning programs, interactive course content, and actionable outcomes for you and your team. Take advantage of our online courses and certification to get the most out of our products.
- Web Analytics Fundamentals (1hr)
- User Feedback and Analytics Settings (30mins)
- Analytics Overview and Live Analytics (30mins)
Reach out to Siteimprove technical support if you have any questions.
Did you find it helpful? Yes No
Send feedback