This guide counts your site's page views in a few minutes. It assumes you have registered and added a site.
1. Add the script tag
In the app, open your site, then Install. Copy the tag, which has your site id filled in, and put it in the <head> of every page:
<script defer src="https://in.crowne.io/v1/script.js" data-site="YOUR_SITE_ID">
</script>On a site with a shared layout, add it once to the layout. The tag counts each page load and each in-app navigation on its own.
2. Check that it counts
Open your site in a browser, on one of the domains you added. Then open your site's dashboard in the app. Your visit shows in the live count at the top, and in the page views, within a minute.
Nothing shows? Check that:
- The page's domain is one of the site's domains, or a subdomain of one. crowne drops events from other hosts, such as
localhost. - An ad blocker does not block the script. Ad blockers tells how to lose fewer visits.
3. Count an action
Count a signup, a purchase, or any action with a custom event:
crowne("signup", { plan: "pro" });Then make it a goal in the site's Settings, so the dashboard shows conversions.
Next
- Installation: the npm package for bundled apps, or the server package for events from your server.
- Custom domain or first-party proxy: lose fewer visits to ad blockers.
- Custom dashboards: build your own views of the data.