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

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