Skip to main content

Google Tag Manager

You can install Produktly through Google Tag Manager using a Custom HTML tag. The Produktly install snippet is a standard async loader that uses only DOM APIs, so it works in GTM without any modifications.

Installation

  1. In Google Tag Manager, go to Tags → New → Tag Configuration → Custom HTML.
  2. Paste the full <script>...</script> snippet from your Produktly support page into the HTML field. The snippet already includes your Client Auth Token.
  3. Under Triggering, choose All Pages (Page View). This fires the tag as early as possible, matching how the script normally loads from the page <head>.
  4. Open Advanced Settings → Tag firing options and leave it at Once per page (default).
  5. Save the tag, then Submit and Publish the container.

That's it. Produktly will now load on every page, the same as if you had pasted the script directly into <head>.

To verify the install, open any page on your site and run window.Produktly in the browser console — if it's defined, the loader has fired.

Single-page applications (SPAs)

You only need the loader tag to fire once per page load. Produktly handles client-side route changes internally, so a History Change trigger is not required.

Identifying logged-in users

If you want to call window.Produktly.identifyUser through GTM, the cleanest pattern is:

  1. After login, push the user data to dataLayer:

    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
    event: "user_identified",
    user_id: "123",
    user_plan: "startup",
    user_company_id: 42,
    });
  2. In GTM, create Data Layer Variables for user_id, user_plan, and any other fields you want to send.

  3. Create a second Custom HTML tag with this content:

    <script>
    window.Produktly.identifyUser({{user_id}}, {
    plan: {{user_plan}},
    companyId: {{user_company_id}}
    });
    </script>
  4. Trigger it on a Custom Event trigger matching user_identified.

The base loader sets up a queue stub on window.Produktly, so calling identifyUser is safe even before main.js finishes loading — the call will be replayed once the script is ready.

Content Security Policy

If your site uses a Content Security Policy, allow the Produktly domains:

  • script-srchttps://public.produktly.com
  • connect-srchttps://api.produktly.com and https://public.produktly.com (only if you restrict connect-src)

If you gate analytics scripts behind GTM Consent Mode, you can attach the Produktly tag to your existing consent trigger so it only loads after the user has accepted. Produktly does not require a specific consent type — choose whichever category fits your privacy policy (typically analytics_storage or a functional category).

FAQ

Can I use the Client Auth Token as a GTM variable?

Yes. If you manage multiple environments (staging vs production), you can store the token in a Constant variable and reference it in the snippet (s.dataset.clientToken = "{{Produktly Token}}";). For most setups, hard-coding the token directly in the snippet is fine — the token is safe to expose publicly.

Does the snippet block page rendering?

No. The injected <script> uses async, so it loads in the background and never blocks the page.

Can I install Produktly through GTM if I already have it in <head>?

Don't do both — pick one. The loader has internal protection against double-initialization, but having two install paths makes troubleshooting harder.