Wednesday, 7 April 2021

Access Google Tag Manager dataLayer field values on gtm.formsubmit

I am trying to pick up the selected value for a drop down field on a form when the form is submitted. Through the developer console in Chrome, I can see the value I want in the GTM dataLayer. It is inside the gtm.element[1] in the screenshot.

enter image description here

However, when I access that with dataLayer[5]["gtm.element"] the console returns the HTML for the form itself without the JSON structure or rest of the data I need to access.

enter image description here

Is there a way to access gtm.element and keep the JSON structure in the first screenshot?



from Access Google Tag Manager dataLayer field values on gtm.formsubmit

No comments:

Post a Comment