Google标签管理器图像点击
我正在SharePoint网站上使用Google Analytics(分析)。在主页上,我们在图像旋转木马中有一个图像,一旦单击,它将带您到网站上的另一个页面。我已经尝试了所有内容以跟踪GTM中此图像的点击 - 单击URL,单击ID,CSS选择器等。我无法弄清楚为什么触发器永远不会发射。我附上了 image,当我单击“检查”,和变量,这些变量在单击中显示gtm预览 ... (这是预览中的后半部分)。总共三张图像。
I am using Google Analytics on a Sharepoint site. On the main page, we have an image in an image carousel that once clicked will bring you to a different page on the site. I have tried everything to track clicks on this image in GTM - click url, click ID, css selector, etc. I can not figure out why my trigger never fires. I have attached the
image, what pops up when I click inspect, and variables that show up with the click in GTM preview... (This is the second half of the variables in preview).Three images total.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
包括所有相关调试信息的好工作。
从检查来看,您正在查看图像。
但是,从您的点击事件检查来看,点击降落在a上。
我在屏幕截图上没有看到您的DOM中的A,但可以动态添加,或者只是在屏幕截图之外。
不管。让我们开始仔细调试它。制作触发器,该触发器会触发在与a匹配的任何匹配上。那只是调试触发器。确保它触发图像点击。
现在,让我们做一个简单的CJS变量,该变量将
console.log({{{click element}})
。无需在任何地方使用它,只需做到即可。再次转到调试视图,尝试再次单击横幅,然后在控制台上查找看起来像这样的东西:看到那个漂亮的元素吗?现在,出色的开发控制台使您可以将JS路径复制到此元素,并对它进行任何操作。主要,舒适,快速测试CSS选择器针对此元素。我建议更改生成的选择器JS控制台。它应该起作用(除非页面太动态),但是它会很脆弱。但是,拥有元素,您将能够制作自己的选择器。
Good job on including all the relevant debugging info.
Judging from your inspect, you're looking at the image.
However, judging from your click event inspection, the click lands on an a.
I don't see the a in your DOM on the screenshot, but it may be either dynamically added, or just outside of the screenshot.
No matter. Let's start to carefully debug it. Make a trigger that would be triggered on anything that matches a. That's just a debugging trigger. Make sure it triggers on your image clicks.
Now, let's just make a simple CJS variable that would
console.log({{Click Element}})
. No need to use it anywhere, just make it. Go to the debug view again, try clicking the banner again and look in the console for something that would look like this:See that pretty element? Now the wonderful dev console allows you to copy JS path to this element and do whatever you want with it. Mainly, comfortably and quickly test CSS selectors against this element. I suggest changing the selector JS console generated. It should work (unless the page is too dynamic), but it would be fragile. Having the element, however, you'll be able to make your own selectors.