File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66<!DOCTYPE html>
77< html class ="no-js " lang ="{{ request.LANGUAGE_CODE }} "{% if DIR %} dir ="{{ DIR }} "{% endif %}{% if settings.GTM_CONTAINER_ID %} data-gtm-container-id ="{{ settings.GTM_CONTAINER_ID }} "{% endif %} >
88< head >
9+ {% include "includes/google-analytics.html" %}
10+
911 {% block head_top %}{% endblock %}
1012 < meta http-equiv ="Content-Type " content ="text/html; charset=utf-8 "/>
1113
5658 {% if canonical_url %}
5759 < link rel ="canonical " href ="{{ canonical_url|safe }} " />
5860 {% endif %}
59-
60- {% include "includes/google-analytics.html" %}
6161</ head >
6262
6363< body class ="html-{{ DIR }} logged-{% if user.is_authenticated %}in{% else %}out{% endif %} responsive {{ classes }} {{ request.LANGUAGE_CODE }} "
Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ import dntEnabled from "./libs/dnt-helper";
3434 // product should be first match or null
3535 product = ( matches && matches . length > 0 ) ? matches [ 1 ] : null ;
3636
37-
3837 w . gtag ( 'config' , GTM_CONTAINER_ID , {
3938 'dimension1' : product
4039 } ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,16 @@ module.exports = Object.keys(entrypoints).map(entry =>
1818 htmlWebpackPlugin . tags . headTags . forEach ( element => {
1919 element . attributes . nonce = "{{ request.csp_nonce }}" ;
2020 } ) ;
21+ if ( entry == "gtm-snippet" ) {
22+ // Using "blocking" for the "scriptLoading" option doesn't work, so
23+ // for now, let's delete the "defer" attribute for the "gtm-snippet"
24+ // case, because it must block until loaded in order to ensure that
25+ // the "gtag" function is defined before any other JavaScript files
26+ // are executed.
27+ htmlWebpackPlugin . tags . headTags . forEach ( element => {
28+ delete element . attributes . defer ;
29+ } ) ;
30+ }
2131 return htmlWebpackPlugin . tags . headTags . join ( "" ) ;
2232 }
2333 } ) ,
You can’t perform that action at this time.
0 commit comments