{% sw_extends '@Storefront/storefront/component/analytics.html.twig' %}
{% block component_head_analytics %}
{{ config('TigerEcommerceTracking.config.scripts')|raw }}
{% if (config('TigerEcommerceTracking.config.gtagid')) %}
<!-- Google Tag Manager -->
{% if config('TigerEcommerceTracking.config.serversidetrackingurl') %}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'{{ config('TigerEcommerceTracking.config.serversidetrackingurl')|raw }}?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');</script>
{% else %}
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');</script>
{% endif %}
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '{{ config('TigerEcommerceTracking.config.gtagid')|raw }}');
</script>
<!-- End Google Tag Manager -->
{% endif %}
{{ parent() }}
{% endblock %}