{% block component_head_analytics %}
{% if context.salesChannel.analytics and context.salesChannel.analytics.isActive() %}
{% set trackingId = context.salesChannel.analytics.getTrackingId() %}
<script>
window.gtagActive = true;
window.gtagURL = 'https://www.googletagmanager.com/gtag/js?id={{ trackingId }}'
</script>
<script id="sw-google-tag-manager-init" type="javascript/blocked">
window.controllerName = '{{ controllerName|lower }}';
window.actionName = '{{ controllerAction|lower }}';
window.dataLayer = window.dataLayer || [];
window.trackOrders = '{{ context.salesChannel.analytics.isTrackOrders() }}';
function gtag() { dataLayer.push(arguments); }
{% block component_head_analytics_tag_config %}
window.gtagCallback = function gtagCallbackFunction() {
gtag('js', new Date());
gtag('config', '{{ trackingId }}', {
'anonymize_ip': '{{ context.salesChannel.analytics.isAnonymizeIp() }}',
'cookie_domain': 'none',
'cookie_prefix': '_swag_ga',
});
};
{% endblock %}
</script>
{% endif %}
{% endblock %}