The function google_tag_realm_values() makes an assumption that, if variable_realm is enabled, then the non-realm snippet won't be loaded, regardeless of the fact that there's no google_tag variables internationalized.

So, if I use i18n variables in my website, but don't set any of the google_tag variables to be localized, it will try to load the localized snippet, which does not contain any configuration set:

(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];var j=d.createElement(s);var dl=l!='dataLayer'?'&l='+l:'';j.type='text/javascript';j.src='//www.googletagmanager.com/gtm.js?id='+i+dl+'&gtm_auth=&gtm_preview=&gtm_cookies_win=x';j.async=true;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','');

Note the missing environment, token and container ID, which are all properly configured as global variables (not sensitive to language realms).

It seems that google_tag_realm_values() should check also if there's any google_tag variables internationalized, otherwise the non-realm snippet should be used.

Comments

tomyinhauser created an issue. See original summary.

  • solotandem committed 8f9f630 on 7.x-1.x
    Issue #2877815: Save snippets for all realms on settings form submit....
Pasqualle’s picture

This change seems to fixed my issue with missing google_tag js files under files/google_tag/language/..

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

Thanks for the feedback. Changing status to fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.