I am having issues setting up Intercom with the Google tag manager on my NextJS web application. I am using the react-gtm-module as well.
When I don’t set any dataLayer variables or when I am logged out of my application, the default home screen loads. However, when I am logged in I am pushing user data to the dataLayer and using it as variables for the Google Tag.
In my _app.tsx, I have this code
This is global and is what is initializing the Intercom messenger that works when not logged in.
Further along my application structure, I have an auth provider using next-auth that returns different components based off log in status.
This fires when the session changes and passes in null when the user is not logged in.
However, when I preview and the user is logged in and I open the messenger, this is all I get:
The messages section seems to be working fine.
I have two tags set up in GTM, one for install and one for update. Here’s how those are configured:
Install:
Update:
All of the data attributes are dataLayer variables.
In the debug setting during GTM preview, the update fires and I have access to all these variables.
Most of our stuff is proprietary so I am not sure how much more I can provide, I would appreciate all the help I can get.