segmentio/analytics.js-integrations

google-tag-manager add identify properties to dataLayer

ls-jacob-lawrence opened this issue · 0 comments

Hi,

Currently the Segment identify method does not push any user properties to the GTM data layer. Should it?

in the app code

 window?.analytics?.identify('userId123', {
      account: '12345678',
      contact: 'john.smith@company.com',
    });

but when you console.log the window.dataLayer, you only have the page event which is missing the user properties like account and contact

[{
event: "Loaded a Page"
gtm.uniqueEventId: 1
path: "/blah"
referrer: "blah"
search: ""
segmentAnonymousId: "123123123"
title: "blah"
url: "blah"
userId: "userId123"
}]

This means if I want to use the account property as a dataLayer variable in GTM then I need to explicitly call an eventless track on page load with it, or inject it into the dataLayer manually.

Both approaches seem to go against the Segment best practice.

What should the expected behaviour be?