Adding to your website/web app

Return to the docs


Adding Cyan Stats to your website or web app is super easy. Simply add the code snippet bellow to the <head> tag from your website or web application.

<script async src="https://cyanstats.com/cs.js"></script>

☝ Cyan Stats will track incoming data from, and only from, registered websites/ apps.

If your website/ web app is using Server Side Rendering (SSR), you might wanna have a look on how to embed Cyan Stats in a SSR website or web application.

Auto tracking

All page visits are automatically tracked, no matter if it’s a traditional website, an SPA, or PWA. Events are easily tracked as well, both with simple HTML attributes or programmatically.

If you want to automatically track the page scrolling, Cyan Stats get you covered. Add the data-scroll attribute to the script tag, and it will start logging scroll events.

<script async data-scroll="on" src="https://cyanstats.com/cs.js"></script>

Subdomains

In order to send traffic from a subdomain, you must add the data-token attribute to the script tag. The token can be found in settings from your Cyan Stats dashboard.

<script async data-token="[TOKEN]" src="https://cyanstats.com/cs.js"></script>

☝ Make sure to replace [TOKEN] with the token found in settings.

Respecting visitors' privacy

Cyan Stats respects visitors privacy by default. It means that if someone visiting your website or web app has enabled the do not track preference on their browser, Cyan Stats will NOT record the traffic from that session.

However, if visitors have not that configured, and if you offer an opt-out feature in your website or application where users could consciously ask for not being tracked, you can do it programmatically by:

By doing so, Cyan Stats will ignore all the traffic from that session.

Ready to enjoy Analytics again?