How to add our script 
Include these two lines on every page at the end of your <body> (or anywhere else):
<!-- Simple Analytics - 100% privacy-first analytics -->
<script async src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
To install the script on Wordpress, Ghost, WIX, Squarespace, Webflow, Gatsby, Vue, Django, Ruby, and others, go to Install on other platforms.
We have a website setup wizard to test if you installed your script correctly. If you still have problems installing it, please let us know! We helped a lot of people with setting up their script and we love to help you as well. Just contact us.
Server-side tracking
We support server-side tracking, read more about it here.
Non-JavaScript environments
While most people browse the internet with JavaScript enabled, there are still some users who disable it, fully aware that many websites may not function as intended. If you want to capture data from these visitors, consider adding our noscript tag. Be aware that this may also increase traffic from bots, as some don’t have JavaScript enabled.
<noscript><img src="https://queue.simpleanalyticscdn.com/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" /></noscript>
Developers
With Simple Analytics you don’t need to manually trigger page views in SPA. We automatically trigger page views in Single Page Apps (SPA’s) like React, Vue, and Angular. You can also use hash navigation to trigger page views.
Some people like a very light script. All our scripts are heavily compressed and we have an extra light version.
If you want to run the script on localhost, please use our dev (https://scripts.simpleanalyticscdn.com/latest.dev.js) version. Note the .dev part. You might want to overwrite your hostname from localhost to something like dev.example.com (where example.com is your domain) to receive it in your dashboard. Make sure to remove the .dev part from the script on production.
We drop data from some shared preview and proxy domains, like *.vercel.app, *.lovable.app, and *.translate.goog, unless that exact hostname is added to your dashboard. To collect data on such a domain, add the hostname to your dashboard or overwrite the hostname.
When you are done implementing go to your dashboard.
If you encounter issues, don’t hesitate to contact us via our support channels.
Javascript version
If you can’t embed HTML, but you can embed JavaScript, here is the code you need to install Simple Analytics with just JavaScript.
// Simple Analytics - 100% privacy-first analytics
const script = document.createElement("script");
script.setAttribute("src", "https://scripts.simpleanalyticscdn.com/latest.js");
document.head.appendChild(script);
Settings via JavaScript
Instead of data- attributes, you can pass settings with a window.sa_settings object. Define it before the script loads. Settings in this object take precedence over data- attributes.
<script>
window.sa_settings = {
hostname: "example.com",
ignorePages: ["/search/*", "/account/*"],
collectDnt: true,
};
</script>
<script async src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
These settings are available:
| Setting | Same as | Example |
|---|---|---|
hostname |
data-hostname |
"example.com" |
mode |
data-mode |
"hash" |
collectDnt |
data-collect-dnt |
true |
autoCollect |
data-auto-collect |
false |
ignorePages |
data-ignore-pages |
["/search/*", "/vouchers"] |
ignoreMetrics |
data-ignore-metrics |
["timeonpage", "scrolled"] |
allowParams |
data-allow-params |
["product-id"] |
nonUniqueHostnames |
data-non-unique-hostnames |
["checkout.stripe.com"] |
strictUtm |
data-strict-utm |
true |
namespace |
data-namespace |
"ba" |
pathOverwriter |
data-path-overwriter |
"myPathOverwriter" |
metadataCollector |
data-metadata-collector |
"myAddMetadataFunction" |
For pathOverwriter and metadataCollector, use the name of a function on window, not the function itself. The script logs the settings it received in the browser console.
Browser support
We test our script on a wide range of browsers and real devices with BrowserStack. We support browser, OS, and device versions that their vendors still maintain, and we keep testing them for two years after their end of life. Older browser versions with more than 0.1% global usage stay covered.
Open source
Our user facing scripts are open source on GitHub.