当用户点击外部 iframe 中的链接时是否可以触发跟踪像素?
我已将雅虎股票图表添加到我雇主的公司网站上。
但我现在需要在用户单击 iframe(并定向到雅虎财经)时触发跟踪像素。
跟踪像素只是一个标准的 1x1 图像。
任何人都可以想出一种方法来做到这一点吗?
这是它所在的页面:
http://titanironcorp.com/letter-from-ceo/
(参见右侧的雅虎股票图表)
这是雅虎 iframe 代码:
<!-- Start of Yahoo! Finance code -->
<iframe align="right" allowtransparency="true" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="http://api.finance.yahoo.com/instrument/1.0/TFER.OB/badge;chart=5d;quote/HTML/f.white?AppID=kGGnjczXiH7L_1XCo_4qTCp1q_QfckRwmw--&sig=8AwYadBv.K1kUIs0BD6xqpzE6kg-&t=1320612387003" width="300px" height="424px"><a href="http://finance.yahoo.com">Yahoo! Finance</a><br/><a href="http://finance.yahoo.com/q?s=TFER.OB/">Quote for TFER.OB/</a></iframe>
谢谢! 沙
I've added a Yahoo Stock Chart to my employers corporate web site.
But I now need to fire a tracking pixel when a user clicks on the iframe (and is directed to Yahoo Finance).
The tracking pixel is just a standard 1x1 image.
Can anyone think of a way to do this?
Here is the page it is on:
http://titanironcorp.com/letter-from-ceo/
(See yahoo stock chart to the right hand side)
And here is the yahoo iframe code:
<!-- Start of Yahoo! Finance code -->
<iframe align="right" allowtransparency="true" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="http://api.finance.yahoo.com/instrument/1.0/TFER.OB/badge;chart=5d;quote/HTML/f.white?AppID=kGGnjczXiH7L_1XCo_4qTCp1q_QfckRwmw--&sig=8AwYadBv.K1kUIs0BD6xqpzE6kg-&t=1320612387003" width="300px" height="424px"><a href="http://finance.yahoo.com">Yahoo! Finance</a><br/><a href="http://finance.yahoo.com/q?s=TFER.OB/">Quote for TFER.OB/</a></iframe>
Thanks!
Sandy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会尝试用透明 div 覆盖整个 iframe 并在其上放置跟踪像素,但我非常非常怀疑它是否有效(并且它肯定会搞砸 iframe 的行为)
You might trying overlaying the whole iframe with a transparent div and putting a tracking pixel on that, but I'd be very, very skeptical it would work (and it would certainly screw up the behavior of the iframe)
对于非 IE 解决方案,您可以强制事件“useCapture”而不是 bubble,这将允许您在
iframe
本身上放置一个点击事件处理程序。根据 MDN 文档:
For a non-IE solution you can force your event to "useCapture" instead of bubble, which would allow you to put a click event handler on the
iframe
itself.Per MDN Docs: