StatelessID

Apex Www

Decide whether you measure apex and www as one site or two, then paste the correct key on each version so your page view counts land in the right place.

Apex and www are two different origins

From a browser's perspective, example.com and www.example.com are different URLs. If a visitor lands on the apex and another lands on www, they fired two beacons from two origins. StatelessID uses the origin in the beacon to decide which site the page view belongs to.

That means you have a choice to make before you paste the snippet: do you want to see apex and www traffic together in one dashboard view, or separately? Most sites redirect one to the other at the DNS or server level — if yours does that, you only need one key. If both serve live pages (rare but possible), you may want separate registrations.

The most common setup: all visitors hit www.example.com because your server redirects example.com → www. Register www.example.com as your site, paste the key in the template, and you are done. Every page view arrives under the www origin.

If you redirect apex to www

When Apache or nginx redirects example.com to https://www.example.com, the visitor's browser sends only one page load event — on the www version. The snippet on the apex page never fires because the browser never renders it. You only need the snippet on www.

Register https://www.example.com in your dashboard. Paste the snippet in your www template. The apex redirect is invisible to the tracker — no data is lost, no double-counting happens.

If you are on a shared host that handles this redirect through cPanel or a control panel, confirm the redirect is a 301 (permanent) not a 302 (temporary). A 301 causes browsers and crawlers to go directly to www on subsequent visits, which keeps your beacon data clean from day one.

If you redirect www to apex

Some operators prefer the clean look of example.com without www. That is a perfectly valid choice. Set up your redirect so www.example.com sends a 301 to https://example.com. Register example.com (no www) as your site in the dashboard.

Paste the snippet in the template that serves the apex domain. All your page views arrive at the apex origin and the dashboard records them under example.com.

Watch out for mixed redirect loops: if you have a redirect rule that redirects http to https AND a separate rule that redirects apex to www, test the full chain before going live. A misconfigured chain can redirect visitors in a loop or strip the https, causing the beacon to fail on a cross-origin request.

Running apex and www on separate keys

If you genuinely serve different content on example.com and www.example.com — for instance, a landing page at the apex and a documentation site at www — register them as two separate sites and give each its own key. Paste the apex key in the apex template and the www key in the www template.

Your dashboard will show two sites. You can switch between them using the site selector. Traffic from each origin stays separate so you can compare them without mixing the data.

This setup is unusual. The vast majority of sites use one origin with a redirect. If you are unsure which applies to you, open a terminal and run curl -I http://example.com to see the redirect chain. The Location header tells you exactly where visitors land.

Troubleshooting

My dashboard shows page views on two different sites but they are both my homepage. You have two site registrations — one for the apex and one for www — and no redirect between them. Pick one canonical origin, set up a 301 redirect, delete the unused site registration, and consolidate to one key.

After I set up the redirect I stopped seeing page views. Check that the snippet is in the template for the destination URL of the redirect, not the source. If you redirect apex → www, the snippet must be in the www template.

I see page views from example.com and www.example.com mixed together in one site. That happens when the same key is pasted on both origins without a redirect. The dashboard records both but cannot distinguish them by origin alone. Set up a redirect so all traffic consolidates to one URL.

Similar pages