Skip to content
Denne side findes på dansk. Læs på dansk
HeyMySocial
Guides

Install and test tracking

Add your website as a tracking site, paste the two-line snippet, connect it to your cookie banner and your form, and prove with a test event that it works.

20 minutes Updated November 25, 2026

At the end your website reports visits and leads to your workspace, it respects what each visitor chose in your cookie banner, and the app shows that a test sent from your own site arrived. From then on a lead can be tied to the post, ad or link that brought it.

What you need

  • A way to add two lines to the <head> of your site: the theme, a tag manager or whoever builds the site.
  • To know how your cookie banner reports a choice. Most banners can run a line of script on accept and on decline.
  • A role in the workspace that may manage integrations.

1. Add your website

  1. Open Funnels and press Add a website.
  2. Give it a Name people recognise, for example "Main website".
  3. Write the Domain without https://, for example example.com. Only this site may send visits.
  4. Choose the Consent mode:
    • Wait for consent: nothing is stored or sent about a visit until your cookie banner says the visitor agreed. The safe choice in the EU.
    • Run until consent is denied: only where the law lets you measure without asking first.
  5. Press Add website.

You land on the screen for the new site. At the top is the Signing secret, shown only this once. It is for a server that sends leads by webhook, not for the script. Copy it to where your server keeps its secrets, or ignore it for now: you can rotate it later.

In the app a tracking site is simply called a website. One site has one public key (it starts with hms_pk_), which is not a secret.

2. Paste the snippet

Under 1. Put the script on your website, press Copy the snippet and paste the two lines before </head> on every page. They look like this, with your own key:

<script>window.hms=window.hms||function(){(hms.q=hms.q||[]).push(arguments)};</script>
<script async src="https://heymysocial.com/sdk/v1.js?k=hms_pk_…" data-consent="required"></script>

The script is under 3 KB and loads without blocking the page. It sets no cookie and reads nothing about the device. When tracking is allowed for the visitor, it keeps one random session key in the browser's local storage; that is how a later lead is tied to the visit.

Have your banner call one of these when the visitor chooses:

hms('consent', 'granted');
hms('consent', 'denied');

On a site that waits for consent, page views are held back until the first call. If the answer is granted, they are sent; if it is denied, they are dropped and the session key is removed. On a site that runs until consent is denied, the script works from the first page. After denied it removes the session key; page views are still sent, without the key and without the campaign parameters, so they are tied to no visit.

data-consent="required" on the script tag can make a single page stricter than the site's setting. It can never make it looser. More in consent.

4. Send leads from your form

Call this when your form is submitted:

hms('lead', { email: form.email.value, name: form.name.value, phone: form.phone.value });

You can also pass company, a fields object with whatever else the form asked, and an external_id from your own system. The details travel in the body of the request, never in an address.

A lead the visitor submitted is always sent. Without consent it carries no visit and no campaign reference, so it is counted as No consent and stays unattributed.

If your form already posts to your own server, leave the page alone and let the server send the lead to the Webhook address on the same screen, signed with the signing secret. See the tracking webhook.

5. Test it

There are two tests, and they prove different things.

  1. Under 3. Check that it works, press Send a test event. You should see "The test event was received. It created no lead." This proves that HeyMySocial receives and stores events for this site. It says nothing about your website.
  2. Open your site with the test parameter, in the browser:
https://example.com/?hms_test=1

The script then sends one test event straight away, without waiting for the cookie banner, and it creates nothing. Back in the app, No test from your website yet changes to A test from your website arrived, and the event appears in the list, marked Test: created no lead. The list refreshes by itself. On Funnels, the site now says Installation tested.

Then try the real thing: accept the banner on your site, load a page and submit your form with your own details. A visit and a lead should appear in the list, and the lead under Leads.

When nothing arrives

Check Why
View the source of the page: are both lines there, with the right key? A tag manager may add them only on some pages, or after a consent step of its own.
Is the page on an address listed under Allowed origins? A new site allows https:// on the domain and on www. Other subdomains, such as a shop or a booking page, must be added, one per line. Anything else is refused.
Does Status say Receiving? A paused site receives nothing: the script goes quiet.
Did the banner call hms('consent', 'granted')? On a site that waits for consent, no visit is sent before it. The ?hms_test=1 test still arrives, which tells the two problems apart.
Did you change a setting a moment ago? The script picks up a change within five minutes.
The test arrives but leads do not Your form is not calling hms('lead', …), or it leaves the page before the call runs.

Events that arrive but name a lead, a sale or a campaign HeyMySocial does not know are kept and listed on Funnels under Items to review. They are not dropped.

Or ask your assistant

Say: "Set up tracking for example.com." The assistant calls manage_tracking_sites with the action create and gives you the snippet and the install steps. When the snippet is on your site, it calls the action test and asks you to open the test address; seen_from_the_website in its reply turns true once the snippet works. It never receives the signing secret, and it should not say tracking works before events have arrived.

Where to go next

Try it on the demo workspace

A labelled demo workspace is offered when you set up your account, so you can follow this guide before you connect anything real.