Add tracking codes to your site
To add Google Tag Manager, the Meta (Facebook) Pixel, or another tracking code to WordPress, load it once on every page: through your theme's tracking settings, a plugin built for that tool, or a plugin that adds code to your site's header. Whichever you use, load each tool only one way, or every visit is counted twice.
On a Dirigible site, tracking codes go in Dashboard → Tracking & Privacy, so you don't need a plugin. If the vendor gives you an ID, use the matching ID field. Use Custom Embeds only when you have to paste a full snippet of code.
Open the right section
- Go to Dashboard → Tracking & Privacy.
- Use Analytics & Tracking for IDs, or Custom Embeds for full snippets.
- Select Save Settings when you're done.
Which tracking ID goes in which field?
Paste the ID into the matching field. Each field also accepts the vendor's full install code and keeps just the ID. Leave fields you don't use blank.
| Field | What to paste | Looks like |
|---|---|---|
| Google Analytics & Ads IDs | GA4 Measurement ID, plus any Google Ads IDs, separated by commas | G-XXXXXXXXXX, AW-XXXXXXXXX |
| Google Tag Manager ID | GTM container ID | GTM-XXXXXXXX |
| Facebook Pixel ID | Meta Pixel ID | digits only |
| LinkedIn Partner ID | LinkedIn Insight Tag partner ID | digits |
| StackAdapt ID | StackAdapt pixel ID | as provided by StackAdapt |
| Hotjar ID | Hotjar site ID | digits |
| HubSpot Portal ID | HubSpot Hub ID, from your HubSpot tracking code. Also set HubSpot Region if your account is in the EU. | digits |
| Piwik PRO Account Address and Piwik PRO Container ID | Your Piwik PRO account address and the site's container ID | example.piwik.pro and a long code with dashes |
Two fields in the same section are for proving you own the site, not for tracking visitors:
| Field | What to paste |
|---|---|
| Google Site Verification ID | Google's HTML-tag verification meta tag, or just the code inside content="…". See Add your WordPress site to Google Search Console. |
| Facebook Domain Verification ID | The token from Meta's domain verification meta tag. See Verify your domain with Meta (Facebook). |
To create a GA4 Measurement ID and check that data arrives, see Add Google Analytics 4 to WordPress.
Google Analytics and Tag Manager together
Both load if both are filled in. If your Tag Manager container already loads your GA4 tag, leave that ID out of Google Analytics & Ads IDs, or every visit is counted twice.
When tracking loads
| Control | What it does |
|---|---|
| Tracking Load Strategy | First Interaction (default) waits on a visitor's first page until they click, scroll, type or move the mouse, or 5 seconds pass, which keeps tracking out of speed tests. Visitors from search, ads, other sites or campaign links are tracked as soon as the page loads. After Page Load starts tracking once every page loads. |
| Track Admin Sessions | Leave off on a live site so your own logged-in browsing isn't counted. Turn it on only while testing. |
| Enhanced Ecommerce Tracking | With WooCommerce, sends purchases to GA4 or Tag Manager when an order completes. |
| Ecommerce Debug Mode | Prints ecommerce events to the browser console. For testing only. |
If the GDPR Banner is on, these ID-based trackers wait until the visitor accepts cookies. See Set up a GDPR cookie consent banner.
What if the tool has no ID field?
Use Custom Embeds, also under Dashboard → Tracking & Privacy, when a tool has no ID field, or your agency sends a full install snippet. Paste it into Tracking Embed, or the head, body, or footer field the vendor names, exactly as supplied. Full steps: Add scripts and chat widgets to your site.
Custom Embeds load as pasted. They don't follow Tracking Load Strategy, and they don't wait for the GDPR Banner unless Load Pasted Tracking Only After Consent is on, so use an ID field whenever one exists.
Common mistakes
- Loading the same tool through an ID field and a Custom Embed (or a plugin). Remove the old pasted code once the ID field is filled in.
- Filling in Google Analytics & Ads IDs with a GA4 ID your Tag Manager container already loads. Every visit is then counted twice.
- Pasting the same snippet into a Custom Embed and a page block. Loading it twice breaks widgets and skews reports.
- Leaving Track Admin Sessions on for a live site.
How do I test a new tag?
Add one tag at a time, then check it in a private window (accept the cookie banner first if it's on). Embed Fonts is still under Appearance → Customize → Scripts & Embeds, and it isn't a tracking code.
Not sure which box to use? See Which box does my code go in?