在 jquery ui 选项卡上放置联属营销跟踪标签

发布于 2024-11-29 06:35:08 字数 739 浏览 0 评论 0原文

我在 jquery 驱动的 asp.net c# Web 应用程序的页面上使用 jquery ui 选项卡。这些选项卡很好地分隔了内容,为用户提供了跨多个页面移动的体验。

我有一家第三方附属公司,他们需要跟踪用户操作,因此希望在每个页面(“选项卡”)上放置像素标签。

如果我将标签直接添加到每个选项卡,那么它将无法正确跟踪,因为所有标签都会在页面加载时被触发。

我正在考虑当用户在选项卡中移动时使用 java 脚本动态加载图像。这是最好的方法吗?如果是,我该如何实现这一目标?任何其他建议。当用户浏览选项卡时,每个选项卡需要包含的内容示例如下:

Tab 1: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=1" width="0" height="0" />
Tab 2: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=2" width="0" height="0" />
Tab 3: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=3" width="0" height="0" />
Tab 4: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=4" width="0" height="0" />

我想放置一些结构,以便我可以轻松添加更多标签以无缝加载每个 ui 选项卡。

I am using jquery ui tabs on a page in my jquery driven asp.net c# web application. The tabs seperate out the content nicely giving the experience to the user that they are moving across multiple pages.

I have a third party affiliate company who need to track users actions and therefore want to place pixel tags on each of the pages ("tabs").

If I add the tags directly to each tab, then it wont track correctly as all will get fired on page load.

I was thinking of loading the image on the fly using the java script as the user moves through the tabs. Is this the best approach and if so how can I achieve this? Any other suggestions. Sample of what needs to be included per tab as the user moves through them is:

Tab 1: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=1" width="0" height="0" />
Tab 2: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=2" width="0" height="0" />
Tab 3: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=3" width="0" height="0" />
Tab 4: <img src="https://xxxxx.com/xxxx.html?p=xxxx&d=4" width="0" height="0" />

I would like to put some structure in place that I could easily add further tags to be loaded per ui tab seamlessly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

农村范ル 2024-12-06 06:35:08

您可以将图像放在各自的选项卡中,但将其 src 属性保留为空。将图像链接放入 HTML5“数据”属性中。

然后,当选择选项卡时,加载图像:

HTML

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">First Tab</a></li>
        <li><a href="#tabs-2">Second Tab</a></li>
        <li><a href="#tabs-3">Third Tab</a></li>
    </ul>

    <div id="tabs-1">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=1" />
        <p>The tabs contents goes here.</p>
    </div>

    <div id="tabs-2">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=2" />
        <p>The tabs contents goes here.</p>
    </div>

    <div id="tabs-3">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=3" />
        <p>The tabs contents goes here.</p>
    </div>
</div>

然后,当您创建选项卡时,传入选择事件处理程序来加载这些图像。

Javascript

$('#tabs').tabs({
    select: function(event, ui)
    {
        $(ui.panel).find('img.affiliate').each(function()
        {
            $(this).attr( 'src', $(this).data('src') );
        });
    }
});

You can put the images in their respective tabs, but keep their src attribute empty. Put the link to the image in the HTML5 "data" attribute.

Then, when the tab is selected, load the image:

HTML:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">First Tab</a></li>
        <li><a href="#tabs-2">Second Tab</a></li>
        <li><a href="#tabs-3">Third Tab</a></li>
    </ul>

    <div id="tabs-1">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=1" />
        <p>The tabs contents goes here.</p>
    </div>

    <div id="tabs-2">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=2" />
        <p>The tabs contents goes here.</p>
    </div>

    <div id="tabs-3">
        <img class="affiliate" src="" height="0" width="0" data-src="https://xxxxx.com/xxxx.html?p=xxxx&d=3" />
        <p>The tabs contents goes here.</p>
    </div>
</div>

Then, when you create the tabs, pass in a select event handler to load those images.

Javascript:

$('#tabs').tabs({
    select: function(event, ui)
    {
        $(ui.panel).find('img.affiliate').each(function()
        {
            $(this).attr( 'src', $(this).data('src') );
        });
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文