analytics.js-integrations icon indicating copy to clipboard operation
analytics.js-integrations copied to clipboard

google-tag-manager add identify properties to dataLayer

Open ls-jacob-lawrence opened this issue 3 years ago • 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: '[email protected]',
    });

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?

ls-jacob-lawrence avatar Aug 02 '22 07:08 ls-jacob-lawrence