You are here

protected function GTMContainer::environmentQuery in GoogleTagManager 7.2

Returns a query string with the environment parameters.

Return value

string The query string.

2 calls to GTMContainer::environmentQuery()
GTMContainer::noscriptSnippet in includes/entity/container.inc
Returns JavaScript noscript snippet.
GTMContainer::scriptSnippet in includes/entity/container.inc
Returns JavaScript script snippet.

File

includes/entity/container.inc, line 321

Class

GTMContainer
Defines the container configuration entity.

Code

protected function environmentQuery() {
  if (!$this
    ->get('include_environment')) {
    return '';
  }

  // Gather data.
  $environment_id = $this
    ->variableClean('environment_id');
  $environment_token = $this
    ->variableClean('environment_token');

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