Google Tag Manager <> inwink

This online help explains how Google Tag Manager works with inwink.

You don't need to add any scripts to your inwink site for Google Tag Manager to work. Simply add the Google Tag Manager ID in the Website > Webmaster > Analytics tab.

Google Tag Manager is a tag management system that allows you to quickly add tracking tags / code fragmentation on a website without intervention in the site code.

Google Tag Manager is therefore not strictly speaking a tracking tool, but a tool to add tracking tools on his site.

Installation of the script in inwink#

By default, when you add Google Tag Manager, it proposes to integrate 2 scripts on your website:

undefined

The first script, to be installed as high as possible in the <head>, contains the Google Tag Manager tracking script. It works as follows:

  • It looks for the script highest in the DOM
  • It inserts before the script a script with the source URL
  • It creates, if it does not already exist, a dataLayer variable in the page, which will then store various information about the use of your site (page views, custom events, consent, etc.) according to your settings

The second script exists to run on browsers that do not allow javaScript.

In the framework of inwink, the first script is not installed as is. Indeed, the script is not installed in the first position in the HTML document of your page, but in a <div> with class injectionplaceholder. This does not impact the functioning of the script, the dataLayer is well created, and the gtm.js script is well installed in the <head>. This is a specificity related to the technology used by inwink websites, React.

The second script is not installed by inwink. Indeed, for its websites, inwink uses a technology called React which cannot work if the user does not allow JavaScript on his browser. If the user does not allow JavaScript, he will not have access to the site. The Google Tag Manager script that works only if the user does not allow JavaScipt is therefore useless.

Page tracking

By default, Google Tag Manager does not track page views. To do so, you need to create a trigger in Google Tag Manager on the viewed pages, and then transmit this information to the tags that you manage with Google Tag Manager if necessary:

undefined

On inwink, however, the native trigger on Google Tag Manager's View Pages does not work properly. This is because inwink uses a relatively new and poorly supported technology from Google Tag Manager, React, with which page changes are actually "simulated":

  • On a traditional site, when a user changes page, he loads a new page, and in particular Google Tag Manager is informed that a new page is seen
  • On an inwink site, when a user changes page, the content of the page is dynamically updated, as well as the URL and the user's history. However, technically, the user does not change the page. This is called a virtual page view. Google Tag Manager does not natively understand this type of page view.

There are several solutions to get around this behavior:

1 . Use the trigger on historical changes to send page views to tags installed on Google Tag Manager. This is a common solution to track page views on sites using a technology similar to inwink (see SPWA, Single Page Web Application):

my picture

This requires a little setting to be done directly in Google Tag Manager, you will find a guide here: https://blogs.infinitesquare.com/posts/web/parametrer-google-tag-manager-gtm-sur-une-single-page-web-application

2. Capture the inwink_page_view event, which inwink triggers at each page change if you are using the inwink <> Google Tag Manager connector (the event returns the URL of the page viewed, the page title, the hash section of the URL, the search section)

Special cases

  • If you have added a CMP to your site, Google Tag Manager will only be installed if you accept cookies on your CMP, and if your CMP is set to allow Google Tag Manager installation
  • When inspecting your page with Google Tag Manager Assitant, you should see an error <script> tag must not be included in a <div> . This error does not impact the proper loading of Google Tag Manager in inwink sites.
  • Google Analytics, in its GA4 version, works as a custom installation of Google Tag Manager. In particular, Google Analytics 4 allows, natively, to track the views on inwink, by observing the changes in the history. If you are using Google Analytics 4 via Google Tag Manager, please remember to either not send inwink's custom inwink_page_views, or to disable the history tracking option in Google Analytics:

undefined