gtm_auth, gtm_preview and gtm_cookies_win query parameters are missing in google analytics iframe src.

Created on 2 June 2023, over 1 year ago
Updated 9 February 2024, 8 months ago

Problem/Motivation

Google analytics iframe src doesn't have all required parameters.

Steps to reproduce

After upgrading to version 2.0.1, google analytics broke in website.

Earlier iframe src having query parameter as given below:

<noscript aria-hidden="true"><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX&gtm_auth=xxxxxxxxxxxxxx&gtm_preview=env-x&gtm_cookies_win=x" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

After upgrading, iframce src doesn't have gtm_auth, gtm_preview and gtm_cookies_win query parameters. Because of this, all non prod data is also capturing in Production funnel.

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXX"
                  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

Proposed resolution

In google_tag_page_top function of google_tag.module, if ($config->get('include_environment')) is always returning false.

This should be replaced by:
$settings = $config->getGtmSettings(); if ($settings['include_environment'])

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇮🇳India deepchandra84

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024