Change the way datalayer placed in head

Created on 14 March 2018, almost 7 years ago
Updated 26 October 2023, about 1 year ago

Currently the dataLayer variable in the head does not take into account that the same variable could be inserted by other module above this script tag. Therefore the inserted is overriden by the datalayer module version of the variable. Instead, it should be merged, not overriden.

Also, GTM docs recommend all the the datalayer stuff should be inserted in the page above the GTM snippet but for now this tag

<script type="text/javascript" src="http://drugan.ee/sites/all/modules/datalayer/datalayer.js?p5kjs3"></script>

is inserted in the middle of other scripts. The issue is that the google_tag module inserts its GTM snippet at the very top of other tags. So, the datalayer tag becomes below it, which is actually wrong.

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇪Estonia drugan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024