@pmeweb/plugin-advertising
v1.1.0
Published
PmeWeb advertising plugin: the Meta pixel and Google Tag Manager, loaded only after the visitor grants « Publicité » in the @pmeweb/consent card.
Readme
@pmeweb/plugin-advertising
The Meta pixel and Google Tag Manager for a PmeWeb site, loaded only after the visitor grants
« Publicité » (the advertising purpose) in the @pmeweb/consent card. Replaces the Meta and GTM
parts of phase 1's @pmeweb/plugin-consent. GTM belongs here, not with audience measurement,
because a container can load anything: it takes the strictest purpose.
- Installed and inactive by default. Listed in
pmeweb.jsonpluginswith neithermetanorgtm, it renders nothing, and@pmeweb/consentbuilds no card for it. - Nothing in the page but one « use » tag.
<Advertising>renders<script type="application/json" data-pmw-consent-use>with the ids that are set and the URL ofdist/load.js. Once the purpose is granted, the decider of@pmeweb/consentpushesad_storage,ad_user_dataandad_personalizationas granted, imports the module and callsload({ meta, gtm }): the Meta pixel bootstrap (initandPageView) and/or the GTM container (gtm.start,gtm.js). No inline code (inlineBudget: 0), nothing at page open, nothing off the site's real hosts.
Config (pmeweb.json plugins.advertising)
| Key | Pattern | Meaning |
|---|---|---|
| meta | ^[0-9]{15,16}$ | The Meta pixel id. |
| gtm | ^GTM-[A-Z0-9]+$ | The Google Tag Manager container id. Set by PmeWeb only, for good (phase 4 never makes it client-editable). |
Either one makes the plugin active.
The client sets meta in the portal, « Contenu › Modules › Publicité » (manifest portal.config,
plugin system phase 4): a change is a draft that ships with « Publier ». gtm is shown there
read-only; it stays with PmeWeb.
GTM: what the operator checks before setting gtm
A container can load anything, and neither this package nor the gate can see inside it.
- The privacy text must describe the container. The
gtmparagraphs say the container loads Google Ads: conversion measurement, remarketing, and enhanced conversions from the hashed email typed into the site's forms. That is what the one site with a container (gestion-reno) does. A container that does something else (another vendor, no enhanced conversions) needs this text changed in a release first, never a site-side edit. - One source of GA4. The container must not configure the GA4 id that
@pmeweb/plugin-audienceloads: every page view would count twice, and that tag would run under « Publicité » instead of « Mesure d’audience ». Remove that tag from the container. - A tag added inside the container may need a CSP host this package does not list (Google Ads
needs
www.googleadservices.com,*.doubleclick.net,www.google.com; CallTrackingMetrics*.tctm.co,*.calltrackingmetrics.com). That is a site change (the site worker's own directives), and a vendor loaded that way is still named on the site's privacy page by the site.
Privacy
privacy/fr.json and privacy/en.json: { heading, paragraphs, byKey: { meta, gtm } }.
<PluginPrivacy> of @pmeweb/consent renders paragraphs, then byKey[k] for each key set, on
the site's privacy page when the plugin is active. The text is the package's, approved once by the
operator, identical on every site. Providers: Meta and Google, both outside Quebec
(manifest.json privacy.providers). Meta's cookie lifetimes are not stated: the text points to
Meta's own policy instead.
CSP
cspHosts({ meta, gtm }) from @pmeweb/plugin-advertising/csp, per key set: meta needs
connect.facebook.net (script) and www.facebook.com (img, connect); gtm needs
www.googletagmanager.com (script, frame, img, connect), *.google-analytics.com,
*.analytics.google.com and *.g.doubleclick.net. {} when inactive.
Check after a deploy
@pmeweb/consent's README « Check after a deploy », advertising case: nothing before answering;
after a grant, fbevents.js and/or gtm.js go out, and dataLayer holds consent update with
ad_storage, ad_user_data and ad_personalization granted.
