Matthew Dresser
Matthew Dresser

Reputation: 11442

Is it ok to pass objects requiring evaluation to the GTM dataLayer variable

When using the GTM (Google Tag Manager) dataLayer variable, is it ok to pass objects whose properties are revealed via getters? In the image below, the last item pushed to the dataLayer array shows ellipses (...) for the properties. When hovering over the ellipses you get the message "Invoke property getter".

I want to confirm whether this can be a problem for GTM or not.

dataLayer object contents

Upvotes: 1

Views: 286

Answers (1)

Victor Leontyev
Victor Leontyev

Reputation: 8736

It will cause the issues in GTM because it's expecting simple JS properties and not getters. In gtm.js it just reading properties and not executing them

Upvotes: 2

Related Questions