Manas
Manas

Reputation: 1

Firing triggers in the Google tag manager based on click element

I have set up GTM on my site and I have a trigger to fire on below conditions

GTM condition for trigger

WHen I test the tag, it does not fire. I chcked the value of element is

'HTMLButtonElement: html.js > body.post-template-default.single.single-p
ost.postid-9022.single-format-standard.logged-in.admin-bar.et-tb-has-tem
plate.et-tb-has-header.et-tb-has-body.et-tb-has-footer.divi-upload-icons
.et_bloom.et_monarch.et_button_no_icon.et_pb_button_helper_class.et_cove
r_background.et_pb_gutter.windows.et_pb_gutters3.et_pb_pagebuilder_layou
t.et_smooth_scroll.et_divi_theme.et-db.customize-support.chrome > div#pa
ge-container > div.et-boc#et-boc > div#et-main-area > div#main-content >
 div.et-l.et-l--body > div.et_builder_inner_content.et_pb_gutters3 > div
.et_pb_section.et_pb_section_4_tb_body.lp_blogs_comments_form.et_section
_regular > div.et_pb_row.et_pb_row_6_tb_body > div.et_pb_column.et_pb_co
lumn_4_4.et_pb_column_7_tb_body.et_pb_css_mix_blend_mode_passthrough.et-
last-child > div.et_pb_module.et_pb_comments_0_tb_body.et_hover_enabled.
et_pb_comments_module.et_pb_bg_layout_light.et_pb_no_reply_button > sect
ion#comment-wrap > div.comment-respond#respond > form.comment-form#comme
ntform > p.form-submit > button.submit.et_pb_button#et_pb_submit'

So why GTM does not work when I use a regex or contains operator. Has anyone else faced this issue?

There are few triggers on this page( https://luminaryproperties.co.uk/venturing-into-your-first-off-plan/?gtm_debug=x) and they all have similar issues.

GTM preview mode error

Upvotes: 0

Views: 929

Answers (2)

darrelltw
darrelltw

Reputation: 2372

I guess GTM is making us misunderstanding about the click element. Seems it can not use "contain" operator.

After I did some test and change it into "matches CSS selector" and it work.

Here is the setting: enter image description here

The value is "div.lp_blogs_navigate, div.lp_blogs_navigate *". It contains the div.lp_blogs_navigate element and all the child elements in it.

Upvotes: 1

Racingman
Racingman

Reputation: 28

I'm not a RegEx expert by any means. But your screenshot showed a RegEx of *lp_blog_comments_form* That does not look correctly formatted.

I ran a test on regex101.com and it did not return any results. I changed it to,

\blp_blogs_comments\B 

This found the HTML tag in the output.

Test String

I'll put this into one of my GTM containers and see if the I can get the Trigger to fire.

Upvotes: 0

Related Questions