You are here

protected function Container::noscriptSnippet in GoogleTagManager 8

Returns JavaScript noscript snippet.

Return value

array The noscript snippet.

1 call to Container::noscriptSnippet()
Container::snippets in src/Entity/Container.php
Returns array of JavaScript snippets.

File

src/Entity/Container.php, line 285

Class

Container
Defines the container configuration entity.

Namespace

Drupal\google_tag\Entity

Code

protected function noscriptSnippet() {

  // Gather data.
  $container_id = $this
    ->variableClean('container_id');
  $query = $this
    ->environmentQuery();

  // Build noscript snippet.
  $noscript = <<<EOS
<noscript aria-hidden="true"><iframe src="https://www.googletagmanager.com/ns.html?id={<span class="php-variable">$container_id</span>}{<span class="php-variable">$query</span>}"
 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
EOS;
  return $this
    ->compactSnippet($noscript, [
    "\n",
  ]);
}