You are here

protected function GTMContainer::noscriptSnippet in GoogleTagManager 7.2

Returns JavaScript noscript snippet.

Return value

array The noscript snippet.

1 call to GTMContainer::noscriptSnippet()
GTMContainer::snippets in includes/entity/container.inc
Returns array of JavaScript snippets.

File

includes/entity/container.inc, line 262

Class

GTMContainer
Defines the container configuration entity.

Code

protected function noscriptSnippet() {

  // Gather data.
  $compact = \GTMSettings::getInstance()
    ->get('compact_snippet');
  $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;
  $noscript = <<<EOS
<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>
EOS;
  if ($compact) {
    $noscript = str_replace("\n", '', $noscript);
  }
  return $noscript;
}