It's possible to add PixelFlow to load within Google Tag Manager, which can be useful for cookie consent and centralized script management if you already use GTM for this.

How to set up PixelFlow with Google Tag Manager

  1. Get your PixelFlow script snippet - PixelFlow will give you a script tag that looks something like this (example):

    <script>!(function(p,i,x,f,l,o,w){p["PixelFlowObject"]=f;p[f]=p[f]||function(){(p[f].q=p[f].q||[]).push(arguments);};p[f].l=1*new Date();o=i.createElement(x);w=i.getElementsByTagName(x)[0];o.src=l;o.async=1;p[f].apiKey="5f1567378cdfg46ccc7785006ba439acddc93";p[f].siteId="68ieiui9db6393302c3";p[f].apiEndpoint="https://api.pixelflow.so/event";w.parentNode.insertBefore(o,w);})(window,document,"script","pixelFlow","https://slrgkgulru.pixelflow.so/pfm.js");</script>

    You can find your script anytime by going to your Overview page and clicking on the copy code button in the "Sites" section

  2. Log in to Google Tag Manager - Go to tagmanager.google.com

  3. Create a new tag:

    • In the left menu, click Tags → New

    • Click Tag Configuration

    • Choose Custom HTML

  4. Paste the PixelFlow script - Paste your PixelFlow script into the HTML box.

  5. Set the trigger - Click Triggering and choose All Pages (or specific pages if you only want it on certain ones). This ensures PixelFlow loads on every page where you want tracking active.

  6. Test and publish:

    • Click Preview to open Tag Assistant and confirm the PixelFlow script loads correctly.

    • If it does, click Submit → Publish to make it live.

Once published, PixelFlow will load through Google Tag Manager on all specified pages, making it easier to manage alongside your consent tools.

If you would like to setup Google Tags Manager to only load the PixelFlow script if the required marketing consent is given (ad_storage) you can do this using Google Consent Mode v2:

  1. Click Tags

  2. Edit your PixelFlow tag

  3. Click Advanced Settings

  4. Click "Require additional consent for tag to fire"

  5. Choose ad_storage

  1. Press Save

  2. Publish your changes in GTM

GTM will now ONLY load PixelFlow if the user has provided "ad_storage" (Marketing) permissions via whatever consent management plugin you're using.

Your script will now only load AFTER the user has accepted the consent AND when the page reloads. To ensure the script triggers WITHOUT having to reload the page you can add one additional consent trigger in GTM

The default behaviour for a script requiring consent to run is the following:

  1. Page Load

  2. Ask for consent

  3. Load script on next page load

This means the script will only load if the user refreshes the page or loads a new page, which is not ideal as you could miss certain interactions on your website. To resolve this, you can simple add a new trigger in GTM to run the script when consent is given.

If you use a consent management plugin like Cookiebot, OneTrust, Iubenda etc. you'll need to enable their integration with GTM to handle consent and trigger the script loading after consent. Your consent management plugin should send consent values into GTM typically through the dataLayer and you can then use that as a trigger to run the script without waiting for a new page load.

Follow these steps to add a new trigger for loading the script after consent is given (without having to wait for a page load). In Google Tag Manager:

  1. Click Triggers

  2. Click New

  3. Click the box to add a new trigger type

  4. Select Custom Event

  5. In the Event Name, enter cookie_consent_update (you can replace this with whatever event name your cookie consent plugin is passing to GTM to notify it of consent)

  6. Name the Event cookie_consent_update

  7. Press Save

  8. Click Tags

  9. Click your PixelFlow tag ("custom HTML")

  10. Click "Triggering" and you'll see a + icon to add a new trigger

  1. Click the plus icon

  2. Select the new "cookie consent update" trigger you created

  1. Press Save

  2. Publish changes

You're now triggering the PixelFlow script to run on:

  • Immediately when consent is given without waiting for a new page load

  • All other page loads that happen after this

Was this helpful?