Skip to main content

Add Google Tag Manager Tracking to Knak Landing Pages

Add Google Tag Manager (GTM) to your Knak landing pages so you can track page activity and visitor behavior.

Updated today

Before You Start

You need:

  • Access to your Knak landing page or brand settings

  • The GTM script code from your Google Tag Manager account


Add the GTM Script to a Single Landing Page

Add the main GTM script in the Tracking Header of your landing page.

Step 1: Copy Your GTM Script

Copy the script below. Replace GTM-XXXX with your container ID.

Copy the following JavaScript and paste it as close to the opening <head> tag as possible on every page of your website, replacing GTM-XXXX with your container ID:

<!-- 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 -->

Step 2: Paste the Script Into the Tracking Header

Open your landing page settings. Then paste the code into the Tracking Header under Advanced Settings.

Paste this code into the Tracking Header under Advanced Settings in your landing page.

Advanced Settings panel with the Tracking Header field highlighted.

Add the GTM Script to All Landing Pages in a Brand

You can also add GTM at the brand level. This applies the code across landing pages in that brand.

Step 1: Open Brand Page Settings

Go to:

Admin > Brands > Select and edit brand > Page Settings

Step 2: Paste the GTM Script

Paste the GTM script into the correct tracking field.

Brand Page Settings screen with the tracking field highlighted.

Step 3: Choose Whether to Lock the Code

You can lock or unlock the code depending on how you want it applied.

Lock icon in brand settings page.

Locked

Use a lock if you want the code to:

  • Apply to all landing pages, including existing pages

  • Apply when a landing page is opened

  • Prevent users from editing the code in individual landing pages

After that, sync or resync the page to your marketing automation platform (MAP) so the update appears on the live page.

Unlocked

Leave the code unlocked if you want the code to:

  • Apply only to newly created landing pages

  • Allow users to edit the code in their individual landing pages


Add the GTM NoScript Code

The noscript version helps support tracking when scripts are disabled or not supported in the browser.

Step 1: Copy the NoScript Code

Copy the following code, replacing GTM-XXXX with your container ID:

<!-- 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) -->

Step 2: Add an HTML Content Block

Add an HTML content block to the top of your landing page.

Adding an HTML content block to the top of a landing page.

Step 3: Paste the NoScript Code

Paste the code into the Custom HTML area.

Make sure you replace GTM-XXXX with your own container ID.

HTML content block settings with the Custom HTML field highlighted.

Why the Script and NoScript Codes Go in Different Places

The main script loads Google Tag Manager for standard browser use.

The noscript code supports tracking when JavaScript is turned off or unavailable.

That is why the two code snippets must be added in different locations.

Confirm Setup

After both code snippets are added, your landing page is set up for GTM tracking.

Add a HTML content block to the top of your landing page and paste the code into the custom HTML area. Make sure you replace the GTM-XXXX with your own container ID.


Troubleshooting

GTM Interferes With Form Follow-Up URLs

The GTM script can sometimes interfere with the JavaScript used to set a form follow-up URL.

If you need both GTM tracking and a specific form follow-up URL:

  1. Keep the GTM script in Knak

  2. Sync the landing page to Marketo

  3. Update the form in Marketo after the sync


Need more help? Contact support via live chat using the chat bubble in the bottom right corner or email support@knak.com.

Did this answer your question?