You are here

function _google_tag_environment_query in GoogleTagManager 7

Returns a query string with the environment parameters.

Return value

string The query string.

2 calls to _google_tag_environment_query()
_google_tag_noscript_snippet in includes/snippet.inc
Returns JavaScript noscript snippet.
_google_tag_script_snippet in includes/snippet.inc
Returns JavaScript script snippet.

File

includes/snippet.inc, line 133
Contains the JavaScript snippet insertion code.

Code

function _google_tag_environment_query() {
  if (!variable_get('google_tag_include_environment', 0)) {
    return '';
  }

  // Gather data.
  $environment_id = _google_tag_variable_clean('google_tag_environment_id');
  $environment_token = _google_tag_variable_clean('google_tag_environment_token');

  // Build query string.
  return "&gtm_auth={$environment_token}&gtm_preview={$environment_id}&gtm_cookies_win=x";
}