Scripts, Privacy, and Performance

Updated

Add analytics, ad pixels, chat widgets, and other third-party code in one place, so it loads the same way on every page without slowing the first view.

Overview: Privacy-Conscious Analytics Loading.

Where the settings are

  • Tracking IDs, the cookie banner's on/off switch and pasted code: Site → Tracking & Privacy. Click Save settings when you're done. Undo in the "Settings saved" message puts back what that save changed, including tracking code the save moved, up to three saves back.
  • The cookie banner's look and wording, and extra web fonts: Appearance → Customize → Scripts & Embeds, then Publish.

Analytics and tracking

In Analytics & tracking:

  1. Enter IDs only for the services you use: Google Analytics, Google Tag Manager, Facebook Pixel, LinkedIn, StackAdapt, Hotjar, HubSpot, Piwik PRO, PostHog, Lead Forensics, and Convert (A/B tests).
  2. Leave the other fields blank.
  3. Choose a Tracking Load Strategy:
    • First Interaction (the default): on a visitor's first page, tracking waits until they first click, scroll, type or move the mouse, or 5 seconds after the page loads, whichever comes first. Visitors from search, other sites, ads and campaign links, and every later page of a visit, are tracked once the page loads. The first load is lighter, and PageSpeed Insights scores don't include your tracking tags.
    • After Page Load: tracking starts once every page finishes loading.
  4. With WooCommerce active, turn on Enhanced Ecommerce Tracking to send purchases to Google Analytics or Tag Manager.

After saving, open the site in a private window and check your provider's debugger to confirm tags are firing.

Cookie banner (GDPR)

In Cookie banner:

  1. On Site → Tracking & Privacy, turn on Enable.
  2. In the Customizer's Cookie banner section, write the message and set the button labels.
  3. Leave Show Privacy Policy Link on to link to your privacy policy from the banner.

While the banner is on, the tracking IDs from Analytics & tracking don't load until the visitor clicks accept.

With a Decline Text button, add a Cookie settings link to #cookie-settings in the footer menu so visitors can change their answer. See Let visitors change their answer.

Custom embeds and fonts

Custom embeds: paste code from trusted vendors for chat, scheduling, or other tools that don't have their own ID field. Code pasted here loads even when the cookie banner is on, unless Load Pasted Tracking Only After Consent is on, so tracking with an ID field (HubSpot, Piwik PRO, PostHog and Convert included) belongs in Analytics & tracking instead. Saving tracking code here asks whether to move it there. Add each tool once. Don't also paste the same code into a page block.

Embed fonts: load Google Fonts or Adobe Fonts families that aren't included in Dirigible Fonts. These also load in the block editor.

Speed settings

The jQuery speed settings are on Optimize Settings → jQuery, part of Dirigible Optimize. Keep the defaults unless a plugin stops working; if one does, check Don't defer jQuery there. Deactivating Optimize turns the jQuery tweaks off too (WordPress's own jQuery loading).

For cache clearing and cleanup tools, see Tools.

Suggested order

Order Task Panel
1 Decide which tracking services you need Analytics & tracking
2 Turn on the cookie banner if you need consent Cookie banner
3 Add chat or booking code Custom embeds
4 Add extra web fonts if needed Embed fonts
5 Check the speed settings Optimize Settings → jQuery
6 Test in a private window —

What to avoid

  • Pasting the same tracking code into individual pages. Use the Tracking & Privacy fields once.
  • Changing speed settings without testing forms, checkout, and the pop-up afterward.
  • Forgetting to click Publish. Unpublished changes never reach visitors.

Verification fields

Google Site Verification ID, Facebook Domain Verification ID and Bing Site Verification ID, under Site verification on Site → Tracking & Privacy, prove to Google Search Console, Meta and Bing Webmaster Tools that you own the domain. They don't track visitors.

Paste the whole meta tag the service gives you, or just the code inside content="…". Google Site Verification ID takes more than one code, one per line, for example when two Search Console accounts verify the same site. See Site verification.

Related guides

Built by Dirigible Studio. Get in touch