TenanciTenanci

Help centerMarketing & A/B tests

Tags, pixels and cookie banner

Add GA4, Google Tag Manager, Google Ads, Meta, TikTok, LinkedIn, Pinterest, Clarity and Hotjar to each domain by pasting just the ID, with a cookie banner (LGPD/GDPR-style) and Consent Mode v2.

Every customer of your app wants to measure their own domain with their own ad accounts. In the domain's Marketing tab you paste just the ID of each tool and Tenanci adds the code to every page, without touching your app. When needed, a cookie banner asks the visitor for consent before the ad pixels turn on.

How it works

The Tenanci edge inserts, in the <head> of every HTML page on the domain, the tag configuration and a small script served from the domain itself (/__tenanci/m.js). That script shows the banner (if enabled) and loads the tools you filled in.

  • It covers every page on the domain, including in-app routes of SPAs: on each route change, Meta and TikTok get a new PageView (GA4 tracks this on its own).
  • Bots don't get the tags, and they are also left out of the TailorKit editor.
  • Each domain has its own configuration: clinic A's pixel never shows up on clinic B's domain.

Add the tags

  1. Open the domain and go to the Marketing tab.
  2. In the Tags and pixels card, paste the ID of each tool the customer uses. Leave the rest empty.
  3. Click Save. You'll see "Marketing saved. Live in a few seconds."

Tenanci cleans up what you pasted (strips spaces, uppercases where the vendor does) and checks the format. If Invalid format shows up under a field, the ID doesn't match that tool's pattern.

Supported tools

Field in the dashboard ID format
Google Analytics 4 G-XXXXXXXXXX
Google Tag Manager GTM-XXXXXXX
Google Ads AW-123456789
Meta (Facebook/Instagram) Pixel digits only (6 to 20)
TikTok Pixel uppercase letters and digits (10 to 30)
LinkedIn Insight Tag digits only (the partner id)
Pinterest Tag digits only (10 to 16)
Microsoft Clarity lowercase letters and digits (6 to 20)
Hotjar digits only (the site id)

Ad pixels use cookies and visitor data. With the banner, the visitor decides before they turn on.

  1. In the Marketing tab, in the Cookie banner card, turn on Show the banner.
  2. Write the Banner text (up to 600 characters; empty uses a default text).
  3. Fill in the customer's Privacy policy link (optional, but recommended).
  4. Pick the Position (Footer (full width), Bottom left corner or Bottom right corner) and the Button color. The Preview shows how it looks.
  5. Click Save.

The banner has two buttons, Accept and Reject. The choice is kept in the visitor's browser for 180 days (tnc_consent cookie), so they don't see the banner again on every page.

To let visitors change their mind later, add a "Cookie preferences" link to the site footer that calls:

window.tenanci?.consent(); // reopens the banner
Tool Before consent After consent
GA4, Google Ads, Google Tag Manager load in "denied" mode (Consent Mode v2): Google measures anonymously, without cookies consent updated to "granted"
Meta, TikTok, LinkedIn, Pinterest, Clarity, Hotjar don't load load
Visitor who clicked Reject only Google, in "denied" mode —

With the banner on, Tenanci sets the Consent Mode v2 defaults (ad_storage, ad_user_data, ad_personalization and analytics_storage as denied) before any Google tag loads, which is what Google requires to honor the choice.

Tenanci's analytics doesn't depend on the banner: it uses no cookies and stores no visitor identifiers (see Analytics).

Scripts from your domain

Ad blockers often block scripts from connect.facebook.net, googletagmanager.com and similar hosts. With Serve scripts from the domain on (card Scripts from your domain), those files are served from https://customer-domain/__tenanci/t/…, which gets around many of those blocks.

Through the API

Read the configuration with GET /domains/:id/marketing, change what you need and send all of it back with PUT /domains/:id/marketing (domains:write scope).

curl -X PUT https://api.tenanci.com/v2/domains/dom_4h7n1q/marketing \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "consent": { "banner": true, "text": null, "policyUrl": "https://clinicaboavista.com.br/privacidade", "position": "bottom", "color": "#0f766e" },
    "tags": { "ga4": "G-AB12CD34EF", "metaPixel": "123456789012345", "gtm": null, "googleAds": null, "tiktok": null,
              "linkedin": null, "pinterest": null, "clarity": null, "hotjar": null },
    "firstParty": false
  }'

Common issues

  • The pixel doesn't fire: with the banner on, Meta, TikTok and the others only load after Accept. Test in a private window and accept the banner.
  • The domain isn't active: tags only show up once the domain is live. See Domains.
  • Duplicate tag: if your app already adds the same pixel on its own, remove it from one place so it isn't counted twice.
  • To record conversions (lead, purchase), see Goals and events.