Skip to content

How to deploy FunnelFlux Javascript with Google Tag Manager (GTM)

Google Tag Manager (GTM) lets you add and update tracking code (“tags”) on your website from the GTM web interface, without editing your pages each time. Once the GTM container snippet is on your pages, you can deploy the FunnelFlux Universal tracking script as a tag.

Read Google’s Google Tag Manager overview.

  1. Sign in to FunnelFlux at /admin/login.php. The app opens the Dashboard at /v2-ui/.
  2. Go to Campaigns and open your funnel.
  3. Right-click the lander or offer node for the page and choose Send Traffic Here.
  4. In the Funnel URL window, turn on Use direct tracking.
  5. Copy the Universal tracking script.

The same script is on System Links under Get campaign link.

Funnel URL window with Use direct tracking on, showing the Direct page URL and the Universal tracking script

The script starts with <!-- FunnelFlux Tracking JS Start --> and ends with <!-- FunnelFlux Tracking JS End -->. Copy all of it, including the <script> and </script> tags.

Create a FunnelFlux tag in Google Tag Manager

Section titled “Create a FunnelFlux tag in Google Tag Manager”
  1. In your GTM workspace, open Tags and click New.
  2. Click Tag Configuration and choose Custom HTML.
  3. Paste the Universal tracking script into the HTML box.
  4. Under Advanced Settings, turn on Support document.write. The FunnelFlux script can call document.write() when it writes page content variations.
  5. Click Triggering and choose All Pages, so the script runs on every page view.
  6. Name the tag, for example “FunnelFlux tracking”, and click Save.

See Google’s Custom tags help page.

GTM Custom HTML tag with the FunnelFlux code pasted and Support document.write enabled

GTM trigger selection with All Pages chosen

If you use one GTM container across pages in different funnels, create one tag per page and use a Page View trigger that matches each page’s URL instead of All Pages. Each node’s script contains that node’s ID.

Place the Google Tag Manager code on your pages

Section titled “Place the Google Tag Manager code on your pages”

In GTM, click your container ID (GTM-XXXX) at the top of the workspace, or go to Admin > Install Google Tag Manager. Either shows two snippets.

GTM Install Google Tag Manager dialog showing the head and body snippets

Copy your code from that dialog rather than from the examples below, because Google occasionally updates it. See Google’s Install a web container help page.

  1. Paste the first snippet as high in the <head> of your lander or offer page as possible, for example:
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
<!-- other head content -->
</head>
  1. Paste the second snippet immediately after the opening <body> tag, for example:
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Note: FunnelFlux records a page visit only if the URL in the browser matches the URL of your lander or offer node, and it needs to know which funnel the user is in. So either send traffic through a FunnelFlux redirect link, or use the Direct page URL from the Funnel URL window. The Direct page URL includes the flux_fts parameter, which identifies the traffic source and funnel.

Direct page URL field in the Funnel URL window showing the full lander URL with flux_fts, flux_fn, flux_cost and tracking fields

GTM can also run tags when your page pushes an event, for example to fire a Meta Pixel event or a Google Analytics 4 event.

Create a trigger:

  1. Open Triggers and click New.
  2. Click Trigger Configuration and choose Custom Event.
  3. Set Event name to test_event.
  4. Name the trigger “My test event” and click Save.

GTM custom event trigger named My test event with event name test_event

Create a tag:

  1. Open Tags and click New.
  2. Name it “test tag”, choose Custom HTML, and paste this code:
<script>
console.log("My trigger works!");
</script>
  1. Under Triggering, choose My test event and click Save.

Now push test_event from your page. For example, change one of your CTA buttons to this:

<a href="#" onclick="dataLayer.push({'event': 'test_event'});">Button 1</a>

When a user clicks the button:

  1. The page pushes test_event to the GTM data layer.
  2. The My test event trigger matches the event.
  3. The “test tag” tag runs.
  4. “My trigger works!” appears in the browser console.

You can attach any number of tags to the same event, so one push can fire several analytics codes.

Changes in GTM do not go live until you publish them.

Click Preview to open Tag Assistant and check which tags fire on your page. Only you see the preview, so use it to test before going live.

When all your tags fire correctly, click Submit in the upper right of the workspace, review your changes, and click Publish.

GTM workspace header with the Submit button in the upper right

See Google’s Preview and debug containers and Publishing, versions, and approvals help pages.

Note: Universal Analytics stopped processing data in July 2023 and was replaced by Google Analytics 4. Use GA4 tags in GTM for Google Analytics; see Google’s announcement.