By default we already include a pixel (image) with our
To collect page views with our pixel you can add parameters to the URL of the image:
<img src="https://queue.simpleanalyticscdn.com/noscript.gif?timezone=Europe%2FAmsterdam&unique=false" referrerpolicy="no-referrer-when-downgrade" alt="" />
In the example above we send a time zone and unique boolean with the pixel.
By default it will take the referrer of the pixel. This is the URL for the page the pixel is displayed on. It is not the referrer of the page, that is inaccessible from the pixel.
We automatically fetch this information via the referrer if you don’t provide anything as pixel parameters: *
trueif protocol of the website is https)
path(path including the
You can overwrite those via the pixel parameters.
These are the values we can’t get with the pixel alone:
- timezone (a valid JS time zone)
- referrer (the document.referrer of the page)
- unique (if a visit is unique; true or false)
- collect-dnt (boolean to tell if it should collect DNT visits)
* We advice to always include the
pathparameters if possible. Some times the browser does not send a referrer with the image and then we can’t store a page view.
We don’t record visitors that have DNT enabled. If you want to record those visits add
collect-dnt=trueto the pixel parameters.
Browser extensions usually don’t have a normal URL and no referrer information. That’s why you need to specify both
<img src="https://queue.simpleanalyticscdn.com/noscript.gif?hostname=example.com&path=%2F" referrerpolicy="no-referrer-when-downgrade" alt="" />
In most cases you can just make up a
extension.mywebsite.com. As long as you add it in your dashboard, it’s fine.
Validate your implementation
If you want to validate your implementation you can test this in your browser. Open the page you implemented the pixel on.
- Right click with your mouse somewhere on the page
- Click “inspect” or sometimes “inspect element” in the menu that pops up
- Click the “network” tab
- Search for a request that ends with “noscript.gif”
- In the sidebar you will see the headers of that request. Look for the “simple-analytics-feedback” header and check the value. It should say something like: “Thanks for sending this page view!”