vendor/shopware/storefront/Resources/views/storefront/component/analytics.html.twig line 1

  1. {% block component_head_analytics %}
  2.     {% block component_head_analytics_gtag %}
  3.         {% if context.salesChannel.analytics and context.salesChannel.analytics.isActive() %}
  4.             {% set trackingId = context.salesChannel.analytics.getTrackingId() %}
  5.             <script>
  6.                 {% block component_head_analytics_gtag_config %}
  7.                     window.gtagActive = true;
  8.                     window.gtagURL = 'https://www.googletagmanager.com/gtag/js?id={{ trackingId }}'
  9.                     window.controllerName = '{{ controllerName|lower }}';
  10.                     window.actionName = '{{ controllerAction|lower }}';
  11.                     window.trackOrders = '{{ context.salesChannel.analytics.isTrackOrders() }}';
  12.                     window.gtagTrackingId = '{{ trackingId }}';
  13.                     window.dataLayer = window.dataLayer || [];
  14.                     window.gtagConfig = {
  15.                         'anonymize_ip': '{{ context.salesChannel.analytics.isAnonymizeIp() }}',
  16.                         'cookie_domain': 'none',
  17.                         'cookie_prefix': '_swag_ga',
  18.                     };
  19.                     function gtag() { dataLayer.push(arguments); }
  20.                 {% endblock %}
  21.             </script>
  22.         {% endif %}
  23.     {% endblock %}
  24. {% endblock %}