要获取ID值到GTM变量中?

时间:2019-12-08 09:32:30

标签: google-chrome google-tag-manager

Sample code image

                                                                                                                               1“>                                                                                                          属性                                                                                                                                                        2“>                                                                                                          个人                                                                                                                                                        4“>                                                                                                          实用工具                                                                                                                                                        5“>                                                                                                          联系                                                                                               

想要每次单击将选项卡ID捕获到变量中,所有字段填写完毕后,表单将转移到下一个选项卡,

2 个答案:

答案 0 :(得分:0)

取决于事件。如果单击,则将Click ID作为元素ID的内置变量:

enter image description here

aria属性没有内置变量,因此您必须创建一个。例如,对于click事件,您可以使用引用实际DOM元素的{{Click Element}},并使用JavaScript(Get aria-expanded value)来获取aria属性值:

enter image description here

答案 1 :(得分:0)

要访问aria-controls属性,可以使用自动事件变量。要创建这个:

  1. 转到变量>用户定义的变量>新建
  2. 点击右上角的“编辑”图标
  3. 选择自动事件变量
  4. 对于变量类型,选择“元素属性”
  5. 对于属性名称,输入aria-controls

enter image description here