This widget inserts the required google tag manager scripts into the head and body tags in order to send page view data to your container.
- Initializes google tag manager on the page.
- Sends either a custom or normal page view event.
- Can customize what data you would like to send with the page view event, including dynamic data.
- Create a new snippet with the page view widget and configure the settings that you'd like to send with each event.
- Be sure to add your measurement ID to the widget.
- Add the snippet to each page layout for which you'd like page data to be sent.
- Configure your GTM container such that you are recording the appropriate information.
- If using google analytics (GA), configure GTM to send the data to the appropriate property in your configuration tag.
- For normal page views in GA:
- Enhanced measurements in GA must be turned on to track page views.
- The configuration tag in GTM must be set to send the page views.
- For custom page views in GA:
- Enhanced measurements in GA must be turned off.
- The configuration tag in GTM should be set to not send page views.
- The custom event tag/trigger in GTM must be configured.
- For normal page views in GA:
The connection to GTM was accomplished using this npm module. For any issues, please submit a change request in its corresponding github repository which is linked from the npm page. For any other requests, please add them to this github repository under the appropriate section.
- Pop-ups and modal pop-ups will not currently send a page view because they are considered minor page interactions.
- Any expression with a datasource under the additional properties will be calculated upon each full page load (browser refresh, initial load, etc.).
- Install NPM package dependencies by using:
npm install
. If you use NPM v7.x.x, which can be checked by executingnpm -v
, execute:npm install --legacy-peer-deps
. - Run
npm start
to watch for code changes. On every change:- the widget will be bundled;
- the bundle will be included in a
dist
folder in the root directory of the project; - the bundle will be included in the
deployment
andwidgets
folder of the Mendix test project.