custom/plugins/TigerEcommerceTracking/src/Resources/views/storefront/component/analytics.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/analytics.html.twig' %}
  2. {% block component_head_analytics %}
  3.     {{ config('TigerEcommerceTracking.config.scripts')|raw }}
  4.     {% if (config('TigerEcommerceTracking.config.gtagid')) %}
  5.         <!-- Google Tag Manager -->
  6.         {% if config('TigerEcommerceTracking.config.serversidetrackingurl') %}
  7.         <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  8.                     new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  9.                 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  10.                 '{{ config('TigerEcommerceTracking.config.serversidetrackingurl')|raw }}?id='+i+dl;f.parentNode.insertBefore(j,f);
  11.             })(window,document,'script','dataLayer','{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');</script>
  12.         {% else %}
  13.             <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  14.                         new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  15.                     j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  16.                     'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  17.                 })(window,document,'script','dataLayer','{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');</script>
  18.         {% endif %}
  19.         <script>
  20.             window.dataLayer = window.dataLayer || [];
  21.             function gtag() {
  22.                 dataLayer.push(arguments);
  23.             }
  24.             gtag('js', new Date());
  25.             gtag('config', '{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');
  26.         </script>
  27.         <!-- End Google Tag Manager -->
  28.     {% endif %}
  29.     {{ parent() }}
  30. {% endblock %}