Dev mode
Debug mode allows you to verify that analytics is properly connected before deploying to production.
By default, all OneDollarStats implementations — including the NPM package and the CDN script — block events and page views sent from localhost to prevent distorting production analytics data.
To enable dev mode:
- When using the NPM package, add the
trackLocalHostAsproperty. - When using the CDN script, add the
data-debugattribute. The value should be the domain of your production website.
import { configure } from "onedollarstats";
configure({
trackLocalHostAs: "mydomain.com",
});After enabling dev mode, run your site locally and open the browser’s developer console. If everything is set up correctly, you’ll see a message confirming that the script was successfully initialized, along with all events being sent.
After enabling dev mode locally and confirming that events are being sent correctly, you need to enable dev mode on the website. Go to onedollarstats.com/analytics, click on the site you’ve connected analytics to, and enable Dev Mode in the top-right corner. This will allow you to see events sent from localhost on your dashboard.