You are here

public function Container::environmentQuery in GoogleTagManager 8

Returns a query string with the environment parameters.

Return value

string The query string.

2 calls to Container::environmentQuery()
Container::noscriptSnippet in src/Entity/Container.php
Returns JavaScript noscript snippet.
Container::scriptSnippet in src/Entity/Container.php
Returns JavaScript script snippet.

File

src/Entity/Container.php, line 343

Class

Container
Defines the container configuration entity.

Namespace

Drupal\google_tag\Entity

Code

public 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}&gtm_cookies_win=x";
}