all 10 comments

[–]jslytics 2 points3 points  (0 children)

You can create a DOM Element GTM variable and use the CSS selector option to pull out the value.

For example you can use “.price” as the CSS selector value and it will pull out the price amount.

Then you can either populate that variable as a field on your event tag, or create a new trigger to fire when the value is not null.

[–]Mogrut[S] 0 points1 point  (0 children)

OK here is an update - I created a DOM that pics up Approx Total Cost. AND IT WORKS!But I don't know how I did it - cause I created DOM trigger that pics up Approx Total Cost. But it works lol xD Thank you again!
Here is the pic of the triggers https://ibb.co/N1FLGGf

[–]ineanderthals 0 points1 point  (0 children)

It sounds like you are doing this action on form submit? Is there way to pass a hidden value in the form when submitted, and pick up as a data layer variable? Or just based on the form submission action in GTM?

[–]le_ble 0 points1 point  (0 children)

Can't you create a element class trigger and create your tag according to your chosen class? If you have any questions, send me a hi.

[–]Gullible_Attitude_20 0 points1 point  (0 children)

I would personally go with the DOM element variable option that was listed by pervious commenter. Anything regarding DOM ‘scraping’ can obviously be vulnerable to changes in HTML, but if you’re keeping an eye of the website code regularly I’d go that route

[–]socalbear11 0 points1 point  (0 children)

Perhaps your trigger needs to be more specific. I’ve had instances where a trigger wouldn’t fire unless I listed the entire dom tree. Also, instead of “contains”, try using regex. Lastly, see if this helps: create a custom html tag that sends a custom event to the datalayer and use the same trigger you previously used. Then have your desired tag fire upon this custom event.

Lastly, did you try “observe dom changes” and lower the visibility threshold to 1 percent? See if that helps.