Skip to content

Web analytics

Turn analytics on in Project › Analytics and HostEdge adds a 1 KB tracker to every HTML page of the project for you, served from your own domain at /_hostedge/script.js. There is nothing to install, and ad blockers that block third-party analytics leave it alone.

You see visitors, pageviews, bounce rate and session time; where visitors came from (channel, referrer, UTM source and campaign); top, entry and exit pages; countries; devices, browsers and systems; goals and funnels; and, once a payment provider is connected, revenue by each of those.

Click any row to filter the whole dashboard to it, for example Campaign: launch and Country: France. Filters live in the URL, so a filtered view can be bookmarked or shared.

Cookies or cookieless#

By default the tracker sets two first-party cookies on your domain: sd_vid (a random visitor ID, one year) and sd_sid (the session, 30 minutes). Nothing is shared with other sites.

In cookieless mode visitors are counted with a hash of the IP address, user agent, your project and the date, mixed with a secret, so no cookie is set and the same person counts as new each day. Revenue attribution needs cookies, because a payment can come days after the first visit.

Goals#

Count a goal when someone clicks an element:

<button data-hostedge-goal="signup" data-hostedge-goal-plan="pro">Start free</button>

Or from JavaScript, anywhere on the page:

window.hostedge('goal', 'newsletter_signup', { source: 'footer' })

Goal names use lowercase letters, digits, dashes and underscores; other characters are converted. Up to ten data-hostedge-goal-* attributes or object keys become properties.

From your server#

Report goals your backend knows about, like an account created after email confirmation. Create a key in Analytics › Settings › Server-side goals, then send the visitor's sd_vid cookie:

curl -X POST https://hostedge.app/api/v1/goals \
  -H "Authorization: Bearer sda_…" \
  -H "Content-Type: application/json" \
  -d '{"visitorId":"<sd_vid cookie>","name":"signup","metadata":{"plan":"pro"}}'

Funnels#

A funnel is 2 to 8 steps, each a page (end with * to match a prefix, like /blog/*) or a goal. A visitor counts for a step only after completing the steps before it, in order.

Revenue#

Connect Stripe, LemonSqueezy or Polar in Analytics › Settings › Revenue:

  1. Copy the webhook URL shown for the provider into its webhook settings and select the events listed.
  2. Paste the webhook's signing secret into HostEdge.
  3. Pass the visitor ID with each checkout, read from window.hostedge.visitorId() in the browser or the sd_vid cookie on your server.
ProviderWhere the visitor ID goesEvents
Stripemetadata.hostedge_visitor_id on Checkoutcheckout.session.completed, invoice.paid, charge.refunded
LemonSqueezycheckout_data.custom.hostedge_visitor_idorder_created, subscription_payment_success, order_refunded
Polarmetadata.hostedge_visitor_id on the checkoutorder.paid, order.refunded

Each payment is attributed to the visitor's first visit: its channel, referrer, campaign, landing page, country and device. Renewals count as revenue in the month they are paid; refunds subtract. Only payments in the project's currency are added up.

Ad spend and ROAS#

Enter what each campaign cost per month in Analytics › Settings › Ad spend, one at a time or as a CSV of campaign,month,amount lines exported from your ads account. The campaign must match the utm_campaign your ads link with. The campaigns table then shows spend and ROAS (revenue from the campaign's first-touch visitors divided by its spend) for the period you are looking at; a month's spend is spread evenly over its days, so a week shows a week's share.

Live visitors#

The Live panel shows who is on the site in the last five minutes, on a dotted world map with one marker per country (bigger for more visitors) next to the pages they are on and where they came from. The same numbers are listed as text for screen readers.

Time zone#

Pick the project's time zone in Analytics › Settings. It decides where "today" starts and ends, the daily buckets and the times on charts. It starts as UTC.

Busy sites#

For sites with about a million events a month or more, the 90-day and 12-month views read from daily totals that HostEdge adds up each night, plus today's raw events, so they stay fast. On those views days are UTC days and a visitor who came on several days counts once per day; the dashboard says so under the chart. A view filtered by one channel, referrer, source, campaign, entry page, country or device reads that value's own daily totals too, as long as it was among the day's top 10 for that column (or the column had no more than 10 values that day); its revenue then counts payments whose first touch matches the filter. Other filters, several filters at once and shorter ranges count from the raw events. A site that just became busy catches up over a few nights and uses the raw events until then.

Excluding visits#

Add paths to ignore in Analytics › Settings, like /admin*. To stop counting your own visits, open your site once with ?hostedge_ignore=1 (and ?hostedge_ignore=0 to count yourself again). Bots and crawlers are never counted.

Public dashboard#

Share a read-only link to the dashboard from Analytics › Settings › Public dashboard, for an open-startup page or investors. Turning sharing off breaks the link at once.

Limits#

PlanEvents per monthHistory
Free20,00030 days
Starter200,0001 year
Pro2,000,0002 years
Agency10,000,0003 years

When a workspace uses its monthly events, new visits stop being counted until the next month or an upgrade; everything collected stays visible.

View this page as MarkdownAll docs as one file