Choose your setup
import { Aside, Card, CardGrid } from “@astrojs/starlight/components”;
Do this short decision step before copying the Quickstart snippet. Lightning can either connect a tag to consent with a bridge or block it until consent; the right choice depends on where that tag is managed.
Google Tag Manager
Section titled “Google Tag Manager”Set the container ID in bridges.google.tagId:
lightning("init", { bridges: { google: { tagId: "GTM-XXXXXXX" }, },});The bridge owns the GTM loader and pushes the Consent Mode default before the
container starts. Keep your individual tags in GTM and set their built-in
Consent Settings there. Verify the result in GTM Preview
and with LightningCMP.debug().
Google tags without GTM
Section titled “Google tags without GTM”Use the same bridge with a measurement or conversion ID:
lightning("init", { bridges: { google: { tagId: "G-XXXXXXX" } },});If your site already loads gtag.js, omit tagId and keep the inline Consent
Mode default at the top of <head>; see Google Consent Mode v2.
Other vendors
Section titled “Other vendors”The Integrations overview explains the same decision for every vendor. As a rule, bridge a vendor that can self-throttle and block a vendor that cannot.
Continue
Section titled “Continue”Return to the Quickstart for the common snippet and the install verification step, or open the configurator again if your stack changes.