Get started
Quickstart
Three steps, no build step and no server code.
1. Create a project
- Create an account. Every account starts on the free plan.
- Create a project and enter your site’s domain, such as example.com. Events are accepted from that domain and its subdomains, so www.example.com and shop.example.com both count. The domain rules explain the details.
- Copy the write key from the install panel. It starts with
wm_w_, and it is safe to publish: it can only send events, and only to this project.
2. Add the script
Paste this tag into the <head> of every page and replace the write key with yours. The install panel in the dashboard shows the same tag with your key already filled in.
Add to every pageHTML
<script defer
src="https://cdn-stg.webmetric.io/v1/b.js"
data-key="wm_w_your_write_key"
data-host="https://in-stg.webmetric.io"></script>Using a framework or a site builder? Follow the guide for your platform:
- HTMLAdd one script tag to the head of every page.
- npmImport the tracker in a bundled app and start it with init().
- Next.jsApp Router and Pages Router, with next/script or the npm package.
- ReactSingle-page React apps built with Vite, Create React App or similar.
- VueVue 3 apps built with Vite, and Nuxt.
- WordPressAdd the tag to your site’s head with a header code plugin or a few lines of PHP.
- ShopifyAdd the tag to theme.liquid so it runs on every storefront page.
- WebflowAdd the tag in your site’s custom code settings.
- SquarespaceAdd the tag to every page with code injection.
- WixAdd the tag as custom code in the head of all pages.
- Google Tag ManagerLoad the tracker from a Custom HTML tag on every page.
3. Check that it works
- Open your site in a browser that does not send Do Not Track or Global Privacy Control. The tracker sends nothing from a browser that signals either.
- The first page view is sent within about five seconds, or as soon as you leave the page.
- Open Overview in the dashboard. The install panel changes to a confirmation when the first event lands.
- Nothing after a minute? Open your browser’s developer tools, find the request to
https://in-stg.webmetric.io/ein the Network tab and look at its status. Troubleshooting explains each one.
Next steps
- Send custom events for the actions a page view cannot show, such as a completed sign-up.
- Build a funnel from the pages and clicks you are already recording.
- Read what the tracker collects and never stores, and exclude your own office from your numbers.
- If your site sends a Content Security Policy, add the two sources the tracker needs.