custom/plugins/WbmTagManagerEcomm/src/Resources/views/storefront/layout/meta.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
  2. {% block layout_head_meta_tags_charset %}
  3.     {{ parent() }}
  4.     {% block wbm_layout_head_tag_manager_data_layer_push %}
  5.         <script>
  6.             let gtmIsTrackingProductClicks = Boolean({{ wbmTagManagerConfig.isTrackingProductClicks|raw }}), gtmContainerId = '{{ wbmTagManagerConfig.gtmContainerId|raw }}', hasSWConsentSupport = Boolean(Number({{ wbmTagManagerConfig.hasSWConsentSupport }}));
  7.             window.wbmScriptIsSet = false;
  8.         </script>
  9.         {% if dataLayer %}<script {{ wbmTagManagerConfig.dataLayerScriptTagAttributes|raw }}>{% verbatim %}
  10.             window.dataLayer = window.dataLayer || [];
  11.             window.dataLayer.push({% endverbatim %}{{ dataLayer|raw }}{% verbatim %});
  12.             {% endverbatim %}{% if onEvent %}{% verbatim %}
  13.             var onEventDataLayer = JSON.parse('{% endverbatim %}{{ onEvent|raw }}{% verbatim %}');
  14.             {% endverbatim %}{% endif %}
  15.         </script>{% endif %}
  16.     {% endblock %}
  17.     {% block wbm_layout_head_tag_manager_snippet %}
  18.         {% if wbmTagManagerConfig.gtmContainerId %}<!-- WbmTagManagerEcomm Head Snippet Start -->
  19.         <script id="wbmTagManger" {{ wbmTagManagerConfig.scriptTagAttributes|raw }}>{% verbatim %}
  20.             function getCookie(name) {
  21.                 var cookieMatch = document.cookie.match(name + '=(.*?)(;|$)');
  22.                 return cookieMatch && decodeURI(cookieMatch[1]);
  23.             }
  24.             var gtmCookieSet = getCookie('{% endverbatim %}{{ wbmTagManagerConfig.wbmCookieEnabledName }}{% verbatim %}');
  25.             {% endverbatim %}{% if wbmTagManagerConfig.gtmFunctionOverwrite is empty %}{% verbatim %}
  26.             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);};
  27.             {% endverbatim %}{% else %}{% verbatim %}
  28.             var googleTag = {% endverbatim %}{{ wbmTagManagerConfig.gtmFunctionOverwrite }}{% verbatim %}
  29.             {% endverbatim %}{% endif %}{% verbatim %}
  30.             if (hasSWConsentSupport && gtmCookieSet === null) {
  31.                 window.wbmGoogleTagmanagerId = gtmContainerId;
  32.                 window.wbmScriptIsSet = false;
  33.                 window.googleTag = googleTag;
  34.             } else {
  35.                 window.wbmScriptIsSet = true;
  36.                 googleTag(window, document, 'script', 'dataLayer', gtmContainerId);
  37.                 googleTag = null;
  38.             }{% endverbatim %}
  39.         </script><!-- WbmTagManagerEcomm Head Snippet End -->{% endif %}
  40.     {% endblock %}
  41. {% endblock %}