themes/BootstrapTheme/templates/bundles/DediSyliusSEOPlugin/Shop/Header/_googleTracking.html.twig line 1

Open in your IDE?
  1. {%- if sylius.channel.googleTagManagerId is not null -%}
  2.     {% if chcookieconsent_isCategoryAllowedByUser('analytics') == true %}
  3.         <!-- GoogleTagManager -->
  4.         <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  5.                     new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  6.                 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  7.                 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  8.             })(window,document,'script','dataLayer','{{ sylius.channel.googleTagManagerId }}');</script>
  9.         <!-- End GoogleTagManager -->
  10.     {% endif %}
  11. {%- elseif sylius.channel.googleAnalyticsCode is not null -%}
  12.     {% if chcookieconsent_isCategoryAllowedByUser('analytics') == true %}
  13.         <!-- GoogleAnalytics -->
  14.         <script async src="https://www.googletagmanager.com/gtag/js?id={{ sylius.channel.googleAnalyticsCode }}"></script>
  15.         <script>
  16.             window.dataLayer = window.dataLayer || [];
  17.             function gtag(){dataLayer.push(arguments);}
  18.             gtag('js', new Date());
  19.             gtag('config', '{{ sylius.channel.googleAnalyticsCode }}');
  20.         </script>
  21.         <!-- End GoogleAnalytics -->
  22.     {% endif %}
  23. {%- endif -%}