javascript - 如何使用 iframe 在提交按钮上实现跟踪像素
问题描述
<iframe src="someUrl" scrolling="no" frameborder="0" width="1" height="1"></iframe>
想象一下我有 iframe,我们想通过它来跟踪我们网站上的注册活动,我们想在提交按钮上实现它,我应该怎么做?我应该只是在提交按钮内添加这个 iframe,还是有其他方法,我的意思是,见下文
<button type="submit">
Text
<iframe src="someUrl" scrolling="no" frameborder="0" width="1" height="1"></iframe>
</button>
解决方案
按钮内部不允许使用 iframe……但无论如何都没有理由在其中放置一个。
跟踪像素用于检测页面何时加载。
尝试将它们放在页面的任何特定部分是没有意义的。
如果您想跟踪表单何时提交:
- 将跟踪像素放在表单提交到的页面上
- 使用基于 JS 的跟踪器来响应按钮上的点击事件或表单的提交事件
推荐阅读
- c - 能够从尚未分配值的malloc'ed范围中读取它是一个安全漏洞吗?
- swiftui - 当按钮靠在一起时,SwiftUI NavigationLink 行为不正确
- python - Allennlp 德国 elmo 模型
- substrate - 如何实现以太坊虚拟机托盘?
- python-3.x - 如何在 Python 中的 Pandas Dataframe 中将 123456.654321 更改为 12:34:56:654321
- reactjs - 如何在 ReactJS 中获取当前路径
- c# - WebApi 返回 json 与返回 OK(json)
- css - css3变换比例的RangeSlider问题
- excel - 下载C盘文件名到指定文件夹
- c - C 代码在 linux 上完美运行,但在 MacOS 上却不行