Pixel Installation
The TNT Growth pixel is a small JavaScript bundle for your website. It reads campaign attribution from the URL, keeps it as visitors move through your site, and reports conversion events back to TNT Growth so they can be attributed to the ad click that produced them.
Your TNT Growth contact will give you the bundle URL and register your HTTPS hostnames. Platform accounts are configured in Flex; the default installation does not need their IDs in your page.
If you would rather see a complete correct installation and the mistakes that quietly lose attribution, start with Good and Bad Installations. It covers the one that costs the most — a pixel installed only on the thank-you page.
1. Add the script
Load the bundle in <head>, before any script that calls it:
<script src="https://YOUR-PIXEL-HOST/flex-pixel.js"></script>
Your TNT Growth contact will give you the exact host to use.
You can also install it through a tag manager. If you do, load it on all pages — attribution is captured on the landing page and used later on your conversion page, so a pixel that only loads on the conversion page will have nothing to attribute.
2. Initialise
Call flexInit once per page load. Flex uses the registered HTTPS hostname to load your configured
platforms. Register each hostname, including landing-page hosts, before installing.
<script>
flexInit();
</script>
You can still pass options without platform IDs, for example flexInit({ cookies: false }).
Initialization waits for the configuration lookup; window.flexInitialized becomes true only after
trackers are ready. An unknown hostname, inactive client, missing platform configuration, or ambiguous
GA4 measurement selection must be corrected in Flex before this mode can initialize.
Existing explicit-ID installations
Existing snippets keep working unchanged:
flexInit({ metaPixelId: 'YOUR_META_PIXEL_ID' });
Supplying any platform-ID property selects the legacy method. Only the IDs you supply are enabled; omitted platforms are never added from your Flex account. This method can initialize without remote platform lookup, though requests still require the existing ownership checks. Do not add empty ID properties to a hostname-based installation. There is no removal date for explicit-ID support.
Configuration reference
| Option | Type | Notes |
|---|---|---|
metaPixelId | string | Meta |
googleAdsCustomerId | string | Google Ads |
bingCustomerId | string | Microsoft Advertising |
linkedInAccountId | string | |
tiktokPixelId | string | TikTok |
redditPixelId | string | |
twitterPixelId | string | X (Twitter) |
openAiPixelId | string | OpenAI (ChatGPT ads) |
googleAnalyticsMeasurementId | string | GA4 |
pixelKey | string | Optional public configuration-only key. See Public pixel configuration key |
cookieDomain | string | Opt in to shared attribution cookies on an owned parent domain; defaults to host-only. See Sites spanning several domains |
googleEnhancedConversions | boolean | Defaults to true. See Enhanced Conversions |
dataLayerCapture | array | Opt-in event and contact field mappings. See Contact data from the data layer |
withHubSpot | boolean | Defaults to false. See HubSpot |
Platform IDs are optional in inferred mode and configured centrally in Flex. Providing any ID property selects the explicit legacy method instead.
HubSpot
Off by default. Set withHubSpot: true only if the site actually runs HubSpot's tracking code:
flexInit({ metaPixelId: '...', withHubSpot: true });
With it on, the Meta _fbp browser cookie is handed to HubSpot's tracker via _hsq.identify on every
page. Email, phone and name go with it only after the visitor submits a form containing them. They land
on the HubSpot contact, which is what lets a conversion reported later from HubSpot carry them through
to Meta.
A submission counts when HubSpot reports a successful submission of one of its forms, or when a site form containing those fields is submitted. For a site form, only fields the browser sends with it count, so a disabled or unnamed field does not. Anything typed into a form and abandoned is never sent, because HubSpot creates a contact from any identify that carries an email. A field that changes after the submission stops being sent until it is submitted again.
Captured email, phone and names are withheld when tracking consent has been denied.
The pixel creates HubSpot's _hsq queue when HubSpot's own snippet has not loaded yet, so that the
identify is processed before HubSpot's first page view — the only ordering that sends it. On a site
with no HubSpot, that would leave captured identifiers queued on the page for something that never
arrives.
Attribution also reaches HubSpot through hidden form fields. Flex administrators can set up the Contact property and add hidden fields to API-editable forms. Supported HubSpot iframe embeds use the vendor's form-instance API, subject to consent and form opt-in. See HubSpot attribution fields and iframe forms.
Public pixel configuration key
Hostname lookup needs no key. If TNT Growth issues you a public pixel configuration key, you may
pass it as pixelKey without supplying platform IDs:
flexInit({ pixelKey: 'YOUR_PUBLIC_PIXEL_CONFIG_KEY' });
This key must have the pixel-config scope and access only /api/attribution/pixel-config. It returns
public configuration; it cannot authorize conversions, read reporting data, or change settings.
Your HTTPS hostname must still be registered to the same active client. Invalid, revoked, shared,
incorrectly scoped, or mismatched keys stop lookup without an anonymous fallback.
Do not combine pixelKey with explicit platform IDs: mixed input is rejected before tracking starts.
Do not use an integration API key, shared server key, or platform access token. The old apiKey
option must be removed: explicit-ID legacy snippets ignore it and never send it, while ID-free
initialization rejects it. No shared API key is bundled with the pixel. The dashboard's default
snippet deliberately needs no key.
Configuration lookup is bounded to two seconds. Events arriving during lookup wait and send once when initialization succeeds. Failure drops waiting events with a diagnostic; correct the cause and retry initialization. Consent denial drops events immediately, and revocation or a superseding initialization cancels events waiting on the old lookup. Repeated inferred initialization after success is ignored. Repeated explicit-ID calls preserve legacy behavior: they can add missing trackers and apply options, without replacing or duplicating existing trackers.
Identify the installed build
Read window.flexPixelVersion in the browser console. Deployed builds identify themselves with a
date and short commit, and send that value on configuration and conversion requests in
X-Flex-Pixel-Version. Your TNT Growth contact can use it with the site hostname to find matching
server logs. Older or unstamped bundles report no version.
Google Tag Manager
Use a tag that loads the bundle and then calls flexInit() on all pages. The planned Gallery template
will use hostname inference by default and offer explicit IDs as a legacy option; it is not shipped
with this release. Only the public pixelKey above is suitable for its optional key field. Wire
consent before initialization when prior permission is required.
Call flexInit before flexTrack, including in a tag manager. Events arriving during inferred
configuration lookup wait for readiness; events sent before initialization starts are dropped.
Call flexInit even in hostname mode. Events cannot be sent until platform initialization succeeds.
A failed configuration lookup must be corrected before retrying; it does not report successful initialization.
3. Track an event
flexTrack({
platform: 'google',
eventName: 'Purchase',
eventTime: Date.now(),
conversionValue: 100.0,
});
platform is required and selects where the event goes: meta, google, bing, linkedin,
tiktok, reddit, twitter, openai or googleAnalytics. It must match a platform resolved from Flex or selected in your explicit-ID snippet.
Commonly used fields:
| Field | Notes |
|---|---|
platform | Required. Which platform to report to |
eventName | The event, e.g. Purchase, Lead |
eventTime | Epoch milliseconds. Defaults to now |
eventId | Your own id for the event, useful for deduplication |
conversionValue | Monetary value in USD; the pixel does not accept a currency override |
userData | Customer identifiers, e.g. email and phone |
customData | Any additional attributes you want recorded |
conversionActionId / conversionName / conversionId | Platform-specific conversion identifiers |
Send one flexTrack call per platform you want the event reported to.
For OpenAI, supply a stable eventId and configure openAiPixelId. The pixel sends only when an
oppref is available. Pass conversionValue in dollars (for example, 49.99); the pixel converts
it to integer cents. Omit the value when unknown. Do not send a non-USD value as conversionValue.
Automatic form capture
Rather than calling flexTrack yourself on submit, you can have the pixel watch a form and capture
fields as they are submitted.
watchForm({
formIdentifier: 'contact-form',
fields: [
{ fieldName: 'email', validationType: 'email', storeInCookie: true },
{ fieldName: 'phone', validationType: 'phone' },
{ fieldName: 'company', validationType: 'text' },
],
});
formIdentifier matches the form's id or its name attribute.
| Field option | Notes |
|---|---|
fieldName | The input's name attribute |
validationType | email, phone or text |
customValidator | Optional function replacing the built-in validation |
storeInCookie | Keep the value for use on later pages, e.g. a thank-you page |
You can call watchForm immediately even if the form is added to the page afterwards — by a framework,
an embedded widget, or a popup. The pixel watches for it and attaches when it appears.
Calling watchForm again for the same formIdentifier replaces the previous watcher rather than adding
a second one, so it is safe to call on route changes in a single-page app.
Populating a hidden field from stored attribution
If your form needs to submit attribution to your own system, flexFieldWatch fills an input from a
stored value when it comes into view:
flexFieldWatch({
fieldName: 'gclid', // <input name="gclid" type="hidden">
cookieName: 'gclid',
});
It returns a function that stops watching, which is worth keeping in a single-page app:
const stopWatching = flexFieldWatch({ fieldName: 'gclid', cookieName: 'gclid' });
// later, on unmount
stopWatching();
Tuning goes in an options property of the same argument object, not a second argument:
flexFieldWatch({
fieldName: 'gclid',
cookieName: 'gclid',
options: { maxAttempts: 40, interval: 250 },
});
options accepts maxAttempts (default 20), interval in ms (default 300), and onError /
onSuccess callbacks. The field is looked for up to maxAttempts times before it gives up.
Sites spanning several domains
Cookies are host-only by default. For a cookie-enabled funnel across your own trusted subdomains, set the same explicit parent domain on every participating host, retaining your existing options:
flexInit({ cookieDomain: 'example.com' });
This shares click IDs, UTMs, tnt_id, browser identity, A/B parameters and sanitized touchpoint data
between www.example.com, lp.example.com and app.example.com. It also supports a later direct
visit to the app without a decorated link, while those cookies remain available. Register every
hostname in Flex as usual; this option does not change API origin authorization.
Only choose a domain whose subdomains you control and trust. The value must be the current hostname
or its parent, and the browser must accept it as a cookie domain. Foreign domains, malformed values
and browser-rejected public/private suffixes fall back to host-only behavior. cookies: false and
consent refusal still prevent storage. Contact data, custom form cookies, _fbp and the visit cookie
remain host-only.
On the first eligible visit after opting in, existing host attribution is promoted when no shared value exists; an existing shared value wins over a stale host copy. Migration gives promoted values their normal cookie lifetime because browsers do not expose the old expiry to JavaScript. On the apex host, existing host-only and shared cookies cannot be distinguished, so the first migration refreshes their lifetime once; a marker prevents repeating that renewal. On child hosts, existing shared first-touch/click cookies keep their expiry. Use the same configuration everywhere: a host running the default or an older build can remove the shared copy on a later write. A consent manager must apply withdrawal on each host; one host cannot delete another host's old host-only cookies or session storage. Previously deleted attribution cannot be reconstructed by this setting.
Cookies cannot span unrelated domains. If shared cookies are unsuitable, configure approved HTTPS link destinations explicitly and include click IDs and UTMs:
flexInit({
linkDecoration: {
domains: ['www.example.com', 'lp.example.com', 'app.example.com'],
utms: true,
},
});
With cookies enabled, linkDecoration: true alone carries only tnt_id; utms: true adds click IDs
and UTMs. Decoration does not carry the original first-touch URL cookie. A visitor must follow a
decorated link before the destination can persist the attribution for subsequent direct returns.
It cannot bridge a landing visit followed by a first direct visit to another host with no handoff.
includeSubdomains: true covers the current hostname and its children, not sibling hosts.
Navigating from your own JavaScript
When link decoration is enabled, the pixel adds the attribution handle to approved links at click time, including links added by a framework or rendered late.
What it cannot see is a navigation your own code performs, because no click ever happens:
window.location.href = '/thank-you'; // the pixel is never told about this
Wrap the URL in flexDecorate when you do that:
window.location.href = flexDecorate('/thank-you');
It returns the URL with tnt_id added, and returns it unchanged if there is no handle yet or the
destination is not one of your own domains — so it is always safe to wrap, and it can never hand your
attribution to a third-party site.
Use flexDecorate when the destination cannot read the source cookie. This includes cookieless
journeys and journeys across hosts without shared cookies; the destination must be approved in
linkDecoration.domains.
Enhanced Conversions
Google Enhanced Conversions improve match rates by sending hashed customer data alongside the click. This is on by default: the pixel passes captured email and phone to your Google tag, both when a form is submitted and on page load if a value was stored earlier. This is usually what clears Google's "tag is firing but not capturing user-provided data" diagnostic.
To disable it for the whole site:
flexInit({ googleAdsCustomerId: '...', googleEnhancedConversions: false });
To disable it for one form only:
watchForm({ formIdentifier: 'internal-form', googleEnhancedConversions: false, fields: [...] });
Contact data from the data layer
For an AJAX form that exposes contact details through a data layer instead of DOM inputs, configure the exact event and field paths to capture:
window.dataLayer = window.dataLayer || [];
flexInit({
dataLayerCapture: [{
event: 'lead_ready',
fields: {
email: 'customer.email',
phone: 'customer.phone',
firstName: 'customer.firstName',
lastName: 'customer.lastName',
},
formIdentifier: 'contact-form',
}],
});
function publishLeadContact(customer) {
if (!window.flexInitialized) {
return;
}
dataLayer.push({ event: 'lead_ready', customer });
return;
}
Call publishLeadContact from the form's AJAX success callback with the approved contact fields,
after tracking permission and pixel initialization are established. The readiness guard drops
early calls; it deliberately does not retain contact data to replay later.
Capture is disabled until mappings are supplied. Each mapping reads only strings at the configured
own, dot-separated properties; inherited values, getters, arrays, pre-hashed identifiers and malformed
email/phone/name values are ignored. Optional formIdentifier connects the event to that form's
watchForm Enhanced Conversions opt-out. That configured opt-out remains after the form leaves the DOM;
call watchForm with googleEnhancedConversions: true to opt the source back in.
Without formIdentifier, the event is an independently approved source.
The tracker-level googleEnhancedConversions: false switch disables data-layer contact capture.
Only future single-message pushes (dataLayer.push(oneEvent)) are captured. Multi-message pushes
are forwarded unchanged, and their consent commands still apply, but their contacts are ignored:
capturing an entire batch before the host processes it would give earlier events the last identity.
Publish separate contact events with separate push calls. Entries already in the queue when listening starts, and events
received while flexConsent(false) applies, are never replayed after a later grant. Create the data
layer before initializing the pixel, retain the same array, and preserve its push handler when adding
other integrations. If GTM replaces the push handler, initialize after that installation. Inferred
initialization must finish before the contact event is published.
The listener runs before the host's current push handler and uses the same validation, contact
storage and Google delivery path as form capture. It emits flex_user_data; configure the GTM
user-provided data tag/variable to consume it before a separate conversion trigger. A conversion
that has already fired cannot be enriched retroactively. After an ads-consent grant, stored eligible
contacts are delivered after the current JavaScript task finishes, with consent checked again.
Fire the conversion after that delivery, or publish a fresh contact event first.
The listener does not call flexTrack,
create another conversion, or identify the visitor to HubSpot. It ignores its own flex_user_data
events to prevent a feedback loop. Configure only events whose contacts are approved for this use;
do not map account, authentication or payment data.
Your consent banner and Google, Microsoft, LinkedIn and GA4
If your consent banner uses Google Consent Mode, the pixel passes the visitor's ad_user_data choice
along with each Google Ads, Microsoft Ads, LinkedIn and Google Analytics (GA4) conversion. It reads the latest choice your banner set through gtag('consent', …),
so a visitor who changes their mind partway through a visit is honoured from then on.
| What your banner set | What Google Ads, Microsoft Ads and LinkedIn receive |
|---|---|
ad_user_data: 'granted' | The click ID and the hashed email and phone |
ad_user_data: 'denied' | The click ID only (gclid, msclkid or li_fat_id). The pixel doesn't send the email or phone to TNT either |
| Nothing (no banner, or a banner without Consent Mode) | Your account's default, which TNT configures with you |
GA4 receives the choice as the Measurement Protocol's consent.ad_user_data. With no choice on the page, GA4 is
sent no consent and uses the consent settings from that visitor's earlier interactions with your site, if it has any,
unless your account's default is Denied, in which case it is sent DENIED.
A default your banner sets only for certain regions (region: [...]) applies only to visitors there,
and the page cannot tell where the visitor is. So when a regional default disagrees with your banner's
general default, the pixel sends nothing until the visitor makes a choice, and your account's default
decides. When they agree, that value is sent. Calling
flexConsent(true) lets the pixel run but is not consent to use the visitor's data for ads, so it
never counts as granted.
Banners that use IAB TCF instead
Some banners record the visitor's choice only through the IAB Transparency & Consent Framework
(__tcfapi), not through Consent Mode. When your page sets no Consent Mode ad_user_data value, the
pixel reads the TCF choice instead, the same way
Google's own tags map TCF to ad_user_data:
| What the visitor chose in the TCF banner | What Google receives |
|---|---|
| Google (vendor 755) allowed, consent to Purpose 1, and consent or legitimate interest for Purpose 7 | granted |
| Google refused, Purpose 1 refused, or Purpose 7 refused on both bases | denied: the click ID only, no email or phone |
| GDPR does not apply to the visitor, or the banner has not answered yet | Your account's default |
If your banner sets Consent Mode as well, Consent Mode wins and TCF is not read, even when the Consent Mode value arrives while the pixel is still waiting for the TCF answer. A visitor who changes their choice in the banner partway through a visit is honoured from then on. The pixel never delays your page for this: a Google conversion sent in the first half second after the pixel finds the banner waits at most that long for its answer, and later conversions never wait.
Consent Mode v2 for EU and UK visitors
Google requires Consent Mode v2 for visitors in the EEA and the UK. If your site has visitors there,
turn on Consent Mode v2 in your consent banner so that it sets ad_user_data (alongside ad_storage,
ad_personalization and analytics_storage) on every page. Most consent platforms have a Google
Consent Mode v2 setting; with your own gtag snippet, set a default and update it when the visitor chooses:
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied',
});
</script>
<!-- then the TNT pixel snippet -->
Put the default above the pixel snippet. With each pageview it already records, and without any
extra request, the pixel tells TNT whether your page had given an ad_user_data signal: a Consent Mode
value, or an answer from an IAB TCF banner for a visitor GDPR
applies to. It reports only whether there was one, never what the visitor chose. TNT uses it to check
that your banner sends the signal, and will let you know if a site with EU or UK visitors sends none.
Global Privacy Control (US "do not sell or share")
When the visitor's browser sends Global Privacy Control
(navigator.globalPrivacyControl === true), the pixel marks each Meta, TikTok and Reddit conversion as opted
out of the sale or sharing of their data. Those platforms then receive their limited-data-use flag:
| Platform | What it receives |
|---|---|
| Meta | data_processing_options: ["LDU"], country and state 0 (Meta geolocates the visitor from their IP address) |
| TikTok | limited_data_use: true (TikTok applies it using the visitor's IP address) |
data_processing_options.modes: ["LDU"] with the country and region of the visitor's IP address |
Each platform needs the visitor's IP address to apply the flag, so an opted-out conversion that has none is
withheld rather than sent unflagged: it is kept, counted, and reported with the reason
us_privacy_opt_out_no_ip (see withheld conversions). On Reddit,
an IP address that cannot be located is retried first, in case the location lookup was briefly unavailable, and
withheld as us_privacy_opt_out_no_location only once the retries are spent. A withheld conversion is not a failed
delivery and raises no alert.
Each platform applies the flag only to visitors in US states whose privacy laws cover it, and it can reduce
audience sizes and optimization there. It is separate from your consent banner's ad_user_data choice and does
not change what Google, Microsoft or LinkedIn receive. X (Twitter) conversions are not flagged yet. Without the
signal, nothing extra is sent.
What the pixel reads from the URL
Captured automatically on every page load and kept for the visit:
Campaign parameters — utm_source, utm_medium, utm_campaign, utm_term, utm_content,
utm_adgroup, utm_device, utm_matchtype
Ad click identifiers — gclid, gbraid, wbraid (Google), fbclid (Meta), msclkid
(Microsoft), twclid (X), li_fat_id (LinkedIn), ttclid (TikTok), rdt_cid (Reddit)
You do not need to do anything for these to be picked up.
Returning visitors and ad clicks
A new click ID replaces the previous value for that platform. Google click identifiers (gclid,
gbraid, wbraid) are selected from the same arrival, so an older GCLID cannot displace a newer
braid. Eligible form fields also use recorded Google touch evidence on direct returns, clearing stale
sibling identifiers when that evidence is available. A Meta arrival retains the earlier Google evidence. Direct visits and internal navigation
without a new click ID do not clear it. First-touch URL/time remain acquisition history.
For example, Google A → Google B → direct visit → lead uses B for a new Google conversion.
An event that happened before B still uses A when the browser has that history. Always supply the
original eventTime when retrying or reporting an older event; a later timestamp changes which
clicks preceded it. Explicitly supplied click IDs take precedence over inferred browser history.
The pixel retains up to 100 observed touches in consent-controlled local storage for its existing
30-day click-retention period, pruning expired entries on subsequent captures. A separate cookie per
platform shares the latest observed touch when cookieDomain is configured. Older history remains
origin-local; clearing storage or moving between unrelated domains can leave it unavailable. These
are retention limits, not a guarantee of platform attribution eligibility. Legacy cookies without
observation history keep their compatibility fallback; their actual click time is unknown.
Campaign fields describe the selected touch only when that pairing is known. Do not combine a Google click ID with Meta campaign tags merely because both are currently stored. The reporting models (first-touch, last-touch, linear and time-decay) distribute analytical credit separately; changing a report model does not change conversion identity or resend an already delivered conversion.
First-touch and last-touch reporting currently mean the earliest and latest eligible paid click
linked to a recorded business outcome within its lookback window. Collection must be enabled for
the client; installing the pixel alone does not populate business outcomes. Direct, organic,
referral, and UTM-only pageviews do not receive credit in these paid-click models.
The firstTouchUrl and lastTouchUrl cookies describe captured pages, not model results or complete
campaign snapshots. See Reading cookies before using them
in a CRM form.
Cookies the pixel sets
Pixel cookies use path=/, Secure and explicit SameSite=Lax, and are written only over HTTPS
when storage and tracking are allowed. They are host-only by default; cookieDomain explicitly
shares the attribution cookies described above.
| Cookie | Expires | Contents |
|---|---|---|
tnt_id | 100 days | Handle for the attribution session this visit created. Not for your own use — see the warning below |
_flextrk_cookie_scope | 100 days | Host-only migration marker recording the accepted shared domain after cookieDomain is accepted; prevents repeated migration on the apex host |
One per campaign parameter — utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_adgroup, utm_device, utm_matchtype | 90 days | The parameter's value |
One per click identifier — gclid, gbraid, wbraid, fbclid, msclkid, twclid, li_fat_id, ttclid, rdt_cid | 30 days | The identifier's value. The shortest lifetime here, so a click id can expire while the campaign parameters that arrived with it are still present |
_flextrk_touch_* | 30 days | Internal latest-touch snapshot per platform; do not modify or use as a conversion ID |
originalReferrer, lastReferrer | 90 days | First and most recent referring domain |
firstTouchUrl, lastTouchUrl | 90 days | Sanitized entry and most recent page URLs |
firstTouchTime, lastTouchTime | 90 days | When those visits happened |
email, phone, text | 90 days | Only when a watched form field has storeInCookie: true |
_fbp | 90 days | Meta's browser identifier, written only if not already present |
Public capture cookies are named after what they hold — a captured email field writes email, and
a Google click ID writes gclid. Internal _flextrk_* cookies and storage keys are reserved.
tnt_id is a bearer token for one visit's attribution. Read it if you are debugging, but do not copy
it into a URL or a form field of your own — the pixel already carries it where it needs to go, and a
copy landing in a page URL can be misread downstream as a Google click ID.
If your site already uses any of these names, the two will overwrite each other. Tell your TNT Growth contact before installing and a different approach can be arranged.
First-touch values are preserved. originalReferrer, firstTouchUrl and firstTouchTime are
written only if not already set, so the original entry point survives for the full 90 days. The
last* values update on every page load.
Stored contact fields such as email and phone remain host-only even with cookieDomain enabled.
Touchpoint URLs are sanitized; retired firstTouchUrlFull and lastTouchUrlFull cookies are cleared.
Do not place secrets or personal information in URLs or enable cookie storage for sensitive fields.
Need to read these values in your own code? See Reading Cookie Values.
Consent and privacy
The pixel honors flexConsent(false) and a host-managed flextrk_consent=0 cookie. Wire your
consent platform to flexConsent. With the optional Flex banner disabled, tracking is allowed after
configuration loads unless the visitor has refused. With it enabled, Flex waits for acceptance.
Where prior consent is required, load the pixel only after permission or deny before calling flexInit.
Load the pixel after consent. Through your consent platform's tag rules, or by deferring the script. Simplest, and right when you would rather the pixel not run at all before a visitor decides. The cost is that a visitor who accepts partway through a visit has no attribution from before they accepted.
Or control tracking permission explicitly. Call flexConsent(false) before initialization,
then grant permission through your banner. cookies: false independently disables persistent pixel
storage; granting tracking permission does not turn storage on. Once tracking is permitted,
cookieless attribution uses a server-side session and approved forms and links:
flexConsent(false);
flexInit({ googleAdsCustomerId: '123-456-7890', cookies: false });
window.addEventListener('cookieConsentUpdate', (event) => {
flexConsent(event.detail.accepted);
});
In this mode the hidden tnt_id field goes into every form, not only the ones you marked — with no
cookie it is one of only two things carrying the handle to your CRM. Pass
formInjection: { optIn: true } alongside cookies: false to keep the marked-forms-only rule, and
formInjection: { deny: ['.site-search'] } to exclude a single form either way.
If changing the snippet is awkward — it lives in your repository and ships on your release — ask us instead. The same settings can be configured on our side for your domain, and your pixel picks them up on its next load with no deploy of yours.
flexConsent(true) permits tracking unless the host consent cookie still vetoes it. Storage remains
disabled when cookies: false; otherwise permitted attribution can be persisted. flexConsent(false)
stops tracking, cancels pending requests, and clears pixel-owned storage.
flexConsent, not flexInit, to change thisCalling flexInit a second time with cookies: true appears to work and does not. Storage turns on,
but attribution, form injection and link decoration have all already initialised and will not run
again, and nothing writes the handle the page is holding — so the next pageview finds an empty jar
and starts a new session.
Checking it works
- Load a page with a campaign parameter, e.g.
?utm_source=test&gclid=test123. - In the browser console,
window.flexInitializedshould betrue. If it isfalse,flexInithas not completed — check the configuration request, hostname registration, configured accounts, consent state, and any script error. - Submit a watched form, or call
flexTrack, and confirm a request to the TNT Growth API appears in the Network tab. - Check that request's response status. A request appearing in the Network tab only shows an
attempt — a
4xxor5xxmeans it was rejected and nothing was recorded. Only a success response means TNT Growth accepted and queued the event. - Once you have a success response, ask your TNT Growth contact to confirm the conversion reached the ad platform. That last step is visible only on our side: acceptance and platform delivery are separate, and a queued event can still fail downstream.
Troubleshooting
| Symptom | Most likely cause |
|---|---|
| No events | Check flexInit, consent, and the configuration request result |
| Events for one platform missing | Account missing in Flex, or omitted from the explicit legacy snippet |
| Form never captures | formIdentifier does not match the form's id or name |
| Attribution lost mid-funnel | The funnel crosses to a different domain — use flexUrlParamSync |
| Google reports no user-provided data | Enhanced Conversions disabled, or no email/phone field captured |
If you are still stuck, send your TNT Growth contact the page URL, your flexInit call, and a
screenshot of the Network tab — that is almost always enough to identify it.
For each of these worked through in full, with the installation that causes it and the fix, see Good and Bad Installations.
Optional Flex consent banner
Your TNT Growth team can enable a fallback consent banner for your website. It is off by default and waits for acceptance before Flex tracking in every region. It checks for supported existing consent managers, waits briefly for late-loading tools, and yields if one appears. Custom consent tools need an installation check; detection is not universal.
The default message is: “We use cookies and similar technologies to measure visits and advertising
conversions. You can accept or reject this tracking and change your choice at any time.”
Accept and Reject have equal prominence. Choices last 180 days on the current origin. Visitors can
reopen the floating Privacy preferences button or call flexShowConsentPreferences(). Global Privacy
Control rejects tracking without displaying the banner. A refusal clears pixel tracking storage.
The banner module loads separately and uses Shadow DOM. Its client configuration supports plain-text message and button labels, HTTPS privacy-policy and logo links, six-digit hex background/text/button colors, system or serif font, bottom bar or left/right bottom card, and a 0–24px corner radius. Contact your TNT Growth team to enable the banner or discuss its appearance.
All initialization modes now load remote consent policy before tracking, including explicit-ID snippets.
If lookup fails, tracking stays blocked until flexInit() succeeds. flexTrack() and watchForm() can
still be called immediately after initialization starts. Await flexInit() and check
window.flexInitialized before calling synchronous helpers such as flexDecorate().
Optional async installation
Your TNT Growth team can provide an async installation that loads the pixel without blocking the page.
Your existing installation keeps working. Do not add async to the old script tag on its own: calls made
before that script loads would fail.
Once your pixel host serves the new loader, use this installation:
<script>
window.flexPixel = window.flexPixel || function (...command) {
(window.flexPixel.q = window.flexPixel.q || []).push(command);
return;
};
flexPixel('init');
</script>
<script async src="https://YOUR-PIXEL-HOST/flex-loader.js"></script>
Use the matching queued calls for your event and form integrations:
flexPixel('track', {
platform: 'google',
conversionActionId: 'YOUR-CONVERSION-ACTION-ID',
eventTime: Date.now(),
});
flexPixel('watchForm', {
formIdentifier: 'contact-form',
fields: [{ fieldName: 'email', validationType: 'email' }],
});
Only send a conversion after the action actually succeeds, using a platform configured for your site.
For explicit platform IDs, pass your existing configuration as flexPixel('init', configuration).
Connect your consent tool to flexPixel('consent', true) or flexPixel('consent', false). A refusal drops
queued conversion events; accepting later does not replay them. All existing consent requirements still apply.
For code that reads a synchronous helper, use flexPixel('ready', callback) and check
window.flexInitialized inside the callback. If tracking is waiting for consent, initialization may still
be incomplete. The loader reports an error and drops its queue if the pixel cannot load; it does not send
queued events after a load failure or timeout.
The loader selects an immutable version of the pixel, allowing the browser to cache the larger script while checking the small loader for updates. If your integration requires a fixed version, ask your TNT Growth team for a pinned script URL. Pinned installations need a URL update to receive later fixes.