<?php
use Twig\Environment;
use function Shopware\Core\Framework\Adapter\Twig\sw_get_attribute;
use function Shopware\Core\Framework\Adapter\Twig\sw_escape_filter;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* @WbmTagManagerEcomm/storefront/layout/meta.html.twig */
class __TwigTemplate_39c27921a168c7ffe288da19d68ac65c extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->blocks = [
'layout_head_meta_tags_charset' => [$this, 'block_layout_head_meta_tags_charset'],
'wbm_layout_head_tag_manager_data_layer_push' => [$this, 'block_wbm_layout_head_tag_manager_data_layer_push'],
'wbm_layout_head_tag_manager_snippet' => [$this, 'block_wbm_layout_head_tag_manager_snippet'],
];
}
protected function doGetParent(array $context)
{
// line 2
return "@RHWebCmsElements/storefront/layout/meta.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@WbmTagManagerEcomm/storefront/layout/meta.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@WbmTagManagerEcomm/storefront/layout/meta.html.twig"));
$this->parent = $this->loadTemplate("@RHWebCmsElements/storefront/layout/meta.html.twig", "@WbmTagManagerEcomm/storefront/layout/meta.html.twig", 2);
$this->parent->display($context, array_merge($this->blocks, $blocks));
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
// line 3
public function block_layout_head_meta_tags_charset($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "layout_head_meta_tags_charset"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "layout_head_meta_tags_charset"));
// line 4
echo " ";
$this->displayParentBlock("layout_head_meta_tags_charset", $context, $blocks);
echo "
";
// line 5
$this->displayBlock('wbm_layout_head_tag_manager_data_layer_push', $context, $blocks);
// line 19
echo " ";
$this->displayBlock('wbm_layout_head_tag_manager_snippet', $context, $blocks);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
}
// line 5
public function block_wbm_layout_head_tag_manager_data_layer_push($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "wbm_layout_head_tag_manager_data_layer_push"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "wbm_layout_head_tag_manager_data_layer_push"));
// line 6
echo " <script>
let gtmIsTrackingProductClicks = Boolean(";
// line 7
echo sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "isTrackingProductClicks", [], "any", false, false, false, 7);
echo "), gtmContainerId = '";
echo sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "gtmContainerId", [], "any", false, false, false, 7);
echo "', hasSWConsentSupport = Boolean(Number(";
echo sw_escape_filter($this->env, sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "hasSWConsentSupport", [], "any", false, false, false, 7), "html", null, true);
echo "));
window.wbmScriptIsSet = false;
</script>
";
// line 10
if (($context["dataLayer"] ?? null)) {
echo "<script ";
echo sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "dataLayerScriptTagAttributes", [], "any", false, false, false, 10);
echo ">";
// line 12
echo "
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(";
echo ($context["dataLayer"] ?? null);
// line 14
echo ");
";
if (($context["onEvent"] ?? null)) {
// line 15
echo "
var onEventDataLayer = JSON.parse('";
echo ($context["onEvent"] ?? null);
// line 16
echo "');
";
}
// line 17
echo " </script>";
}
// line 18
echo " ";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
}
// line 19
public function block_wbm_layout_head_tag_manager_snippet($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "wbm_layout_head_tag_manager_snippet"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "wbm_layout_head_tag_manager_snippet"));
// line 20
echo " ";
if (sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "gtmContainerId", [], "any", false, false, false, 20)) {
echo "<!-- WbmTagManagerEcomm Head Snippet Start -->
<script id=\"wbmTagManger\" ";
// line 21
echo sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "scriptTagAttributes", [], "any", false, false, false, 21);
echo ">";
// line 27
echo "
function getCookie(name) {
var cookieMatch = document.cookie.match(name + '=(.*?)(;|\$)');
return cookieMatch && decodeURI(cookieMatch[1]);
}
var gtmCookieSet = getCookie('";
echo sw_escape_filter($this->env, sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "wbmCookieEnabledName", [], "any", false, false, false, 27), "html", null, true);
// line 28
echo "');
";
if (twig_test_empty(sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "gtmFunctionOverwrite", [], "any", false, false, false, 28))) {
// line 29
echo "
var googleTag = function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'";
echo twig_trim_filter(sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "extendedUrlParameter", [], "any", false, false, false, 29));
// line 30
echo "';f.parentNode.insertBefore(j,f);};
";
} else {
// line 31
echo "
var googleTag = ";
echo sw_escape_filter($this->env, sw_get_attribute($this->env, $this->source, ($context["wbmTagManagerConfig"] ?? null), "gtmFunctionOverwrite", [], "any", false, false, false, 31), "html", null, true);
// line 32
echo "
";
}
// line 42
echo "
if (hasSWConsentSupport && gtmCookieSet === null) {
window.wbmGoogleTagmanagerId = gtmContainerId;
window.wbmScriptIsSet = false;
window.googleTag = googleTag;
} else {
window.wbmScriptIsSet = true;
googleTag(window, document, 'script', 'dataLayer', gtmContainerId);
googleTag = null;
}";
echo "
</script><!-- WbmTagManagerEcomm Head Snippet End -->";
}
// line 44
echo " ";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
}
public function getTemplateName()
{
return "@WbmTagManagerEcomm/storefront/layout/meta.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 209 => 44, 194 => 42, 190 => 32, 186 => 31, 182 => 30, 178 => 29, 174 => 28, 165 => 27, 162 => 21, 157 => 20, 147 => 19, 137 => 18, 134 => 17, 130 => 16, 126 => 15, 121 => 14, 116 => 12, 111 => 10, 101 => 7, 98 => 6, 88 => 5, 77 => 19, 75 => 5, 70 => 4, 60 => 3, 37 => 2,);
}
public function getSourceContext()
{
return new Source("{% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
{% block layout_head_meta_tags_charset %}
{{ parent() }}
{% block wbm_layout_head_tag_manager_data_layer_push %}
<script>
let gtmIsTrackingProductClicks = Boolean({{ wbmTagManagerConfig.isTrackingProductClicks|raw }}), gtmContainerId = '{{ wbmTagManagerConfig.gtmContainerId|raw }}', hasSWConsentSupport = Boolean(Number({{ wbmTagManagerConfig.hasSWConsentSupport }}));
window.wbmScriptIsSet = false;
</script>
{% if dataLayer %}<script {{ wbmTagManagerConfig.dataLayerScriptTagAttributes|raw }}>{% verbatim %}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({% endverbatim %}{{ dataLayer|raw }}{% verbatim %});
{% endverbatim %}{% if onEvent %}{% verbatim %}
var onEventDataLayer = JSON.parse('{% endverbatim %}{{ onEvent|raw }}{% verbatim %}');
{% endverbatim %}{% endif %}
</script>{% endif %}
{% endblock %}
{% block wbm_layout_head_tag_manager_snippet %}
{% if wbmTagManagerConfig.gtmContainerId %}<!-- WbmTagManagerEcomm Head Snippet Start -->
<script id=\"wbmTagManger\" {{ wbmTagManagerConfig.scriptTagAttributes|raw }}>{% verbatim %}
function getCookie(name) {
var cookieMatch = document.cookie.match(name + '=(.*?)(;|\$)');
return cookieMatch && decodeURI(cookieMatch[1]);
}
var gtmCookieSet = getCookie('{% endverbatim %}{{ wbmTagManagerConfig.wbmCookieEnabledName }}{% verbatim %}');
{% endverbatim %}{% if wbmTagManagerConfig.gtmFunctionOverwrite is empty %}{% verbatim %}
var googleTag = function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'{% endverbatim %}{{ wbmTagManagerConfig.extendedUrlParameter|trim|raw }}{% verbatim %}';f.parentNode.insertBefore(j,f);};
{% endverbatim %}{% else %}{% verbatim %}
var googleTag = {% endverbatim %}{{ wbmTagManagerConfig.gtmFunctionOverwrite }}{% verbatim %}
{% endverbatim %}{% endif %}{% verbatim %}
if (hasSWConsentSupport && gtmCookieSet === null) {
window.wbmGoogleTagmanagerId = gtmContainerId;
window.wbmScriptIsSet = false;
window.googleTag = googleTag;
} else {
window.wbmScriptIsSet = true;
googleTag(window, document, 'script', 'dataLayer', gtmContainerId);
googleTag = null;
}{% endverbatim %}
</script><!-- WbmTagManagerEcomm Head Snippet End -->{% endif %}
{% endblock %}
{% endblock %}
", "@WbmTagManagerEcomm/storefront/layout/meta.html.twig", "/home/bardahls/shopware/custom/plugins/WbmTagManagerEcomm/src/Resources/views/storefront/layout/meta.html.twig");
}
}