When someone clicks your ad, the ad platform adds a click id to the address
of the page they land on, like https://yoursite.com/?gclid=abc123. Subcontext
sends that id back to the platform when the visitor becomes a lead or buys
(see Outcomes to ad platforms), so the platform can see
which ads work.
Visitors rarely fill in a form on the page they land on. They land on your
home page, look around, and get a quote on /quote, where the address has no
click id. The webchat, quote form, form guide and lead form handle this in
two ways.
Clicks remembered from an earlier page#
Every embed looks at the page address as it starts. If there is a click id in
it (gclid, gbraid, wbraid, fbclid, msclkid, ttclid or li_fat_id),
and you allow it (see Consent), the embed keeps it in your
website's own browser storage (localStorage), with the time it first saw the
click and the address of the landing page. All the embeds share it, so a click
seen by the webchat on your home page is sent by the quote form on /quote.
- It is kept for 90 days from when it was first seen, the longest any ad platform will credit a click. After that it is deleted.
- A newer click on an ad from the same platform replaces the older one. Google's
gclid,gbraidandwbraidcount as one platform. - The same click seen again keeps its first time and landing page.
- The landing page address is cut down the way Subcontext stores every page
address: campaign tags and click ids keep their values, every other value in
the address is replaced by
[redacted], and email addresses and long codes in the path are removed. - It is stored under one key,
subcontext:click_ids, on your website's own domain. Subcontext's servers can't read it. It only goes to Subcontext inside a chat, quote or lead the visitor starts.
To make the most of this, put the webchat (or any embed) on every page, or at least on the pages your ads link to.
Your ad tags' cookies#
If your website has Meta's pixel or Google's tag, they keep the click in their own cookies, which the embeds also read:
| Cookie | Set by | What the embeds send |
|---|---|---|
_fbc |
Meta pixel | The cookie itself, and the fbclid in it, with the time Meta saw the click. |
_fbp |
Meta pixel | The cookie itself (Meta's id for the browser). |
_gcl_aw |
Google tag | The gclid in it, with the time Google saw the click. |
_gcl_gb |
Google tag | The gbraid in it, with the time Google saw the click. |
Values that don't look like the platform's own are ignored. Reading these
cookies stores nothing new: your tags set them, after your own consent banner
lets them. The _fbp and _fbc values go to Meta with the conversions sent
for that visitor, to help Meta match them (see
Ad platforms).
Which click wins#
For each ad platform, the embeds send the click from the first of these that has one:
- the address of the page the form or chat is on;
- the click remembered from an earlier page;
- your ad tags' cookies.
On the lead form, click ids you set yourself (provenance, or data-gclid and
the others) win over all three. See
Where the visitor came from.
Each click id is sent with the time it was first seen. Subcontext uses that time when it decides whether a platform still credits the click, and when it tells the platform about the conversion.
Consent#
In the UK, keeping an ad click id in someone's browser needs their consent (it isn't needed for your website to work). So the embeds only remember clicks when your page says they may. They check, in this order:
- The
rememberClickIdssetting on the embed.truemeans you have the visitor's consent;falsemeans you don't. Set it from the answer your consent banner saved, when the embed starts. - Google Consent Mode, if your page uses it:
ad_storagegranted means yes, denied means no. - Otherwise, no. Nothing is remembered.
When the answer is no, anything already remembered is deleted. With Consent
Mode's ad_storage denied, the embeds don't read your ad tags' cookies either.
Click ids in the address of the page the form or chat is on are always sent, as
they always have been: that stores nothing in the browser.
Your consent banner usually decides after the page has loaded. With Consent
Mode, the embeds check again each time they send a chat, quote or lead, so a
"yes" given later counts from then on, and a "no" given later deletes what was
kept. The rememberClickIds setting is read when the embed starts, so a
visitor's answer counts from the next page they open.
Setting it#
The setting has the same name on every embed:
| Embed | On the snippet | From JavaScript |
|---|---|---|
| Webchat | data-remember-click-ids="true" |
SubcontextWebchat.init({ rememberClickIds: true }) |
| Quote form | data-remember-click-ids="true" on the placeholder |
Subcontext.Quote.init({ rememberClickIds: true }) |
| Form guide | data-remember-click-ids="true" |
SubcontextFormGuide.attach({ rememberClickIds: true }) |
| Lead form | data-remember-click-ids="true" on the script tag or a form's <div> |
Subcontext.leadform.init({ rememberClickIds: true }) |
Use "true" or "false". Leave it out to follow Google Consent Mode. A quote
form passes its setting on to the webchat and form guide it opens.
If you use Google Consent Mode, you don't need the setting: update consent as usual and the embeds follow it.
gtag('consent', 'update', { ad_storage: 'granted' })