javascript - 如何为点击事件实现 Omniture 自定义链接跟踪?

标签 javascript adobe-analytics

我希望在一个页面的 3 个链接上实现 Omniture 自定义链接跟踪代码。我已经获得了一些 javascript 代码,但不确定我是否需要在页面中使用它,或者我是否只需要将它合并到链接的 onclick 部分。

我以前没有这样做过,并尝试在此处 ( http://microsite.omniture.com/t2/help/en_US/sc/implement/oms_sc_implement.pdf) 和此处阅读相关内容 ( https://developer.omniture.com/en_US/content_page/sitecatalyst-tagging/c-add-a-custom-link ) 但这对我来说意义不大。

这是我到目前为止所做的:

  1. 打开 body 标签后包含指向 s_code.js 的链接

2。抓取 Omniture 提供的代码以跟踪其中一个链接

s.linkTrackVars="eVar45,events";s.linkTrackEvents="event23";s.eVar45="MaturingEquityLines|RenewEquityLOCOverlay"; s.events="event23";s.tl(this,'o','MaturingEquityLines|RenewEquityLOCOverlay');

3。查看 Omniture 自定义链接跟踪的示例

<a href="#" id="community_overlay_trigger" class="delicious" onClick="s.linkTrackVars= s.linkTrackVars+',events,eVar8,prop8,prop13'; s.events='event6'; s.linkTrackEvents='event6'; s.eVar8=s.prop8='delicious'; s.prop13=s.pageName; s.tl(this,'o','Content Share');">delicious</a>

通过比较,我认为我的链接应该这样编码:

<a href="#" id="popoverBtn1" class="popoverThis btn btn-default" data-  placement='bottom' onClick="s.linkTrackVars= s.linkTrackVars+',eVar45,events'; s.events='event23'; s.linkTrackEvents='event23'; s.eVar45='MaturingEquityLines|RenewEquityLOCOverlay'; s.tl(this,'o','MaturingEquityLines|RenewEquityLOCOverlay');">Learn More <span class="glyphicon glyphicon-circle-arrow-right"></span></a>

这看起来正确吗?我需要包含#2 中的脚本吗?在页面的其他地方跟踪链接?

提供给我的代码在示例中没有任何 s.prop 项,我需要它们吗?

是否可以通过控制台知道链接是否在点击时被跟踪?

谢谢,

**********更新************< em>**************** *

抱歉,我之前好像不清楚,因为每个人都在解释我提供的示例,而不是我要实现的代码。

这是我生成的代码,想知道它是否正确。我在页面上使用 jQuery。

<div class="col-md-4">
      <img src="house.gif" alt="House Symbol" />
      <h4>Renew Your<br />Equity Line of Credit</h4>
      <a href="#" id="popoverBtn1" class="popoverThis btn btn-default" data-placement='bottom' onClick="s.linkTrackVars= s.linkTrackVars+',eVar45,events'; s.events='event23'; s.linkTrackEvents='event23'; s.eVar45='MaturingEquityLines|RenewEquityLOCOverlay'; s.tl(this,'o','MaturingEquityLines|RenewEquityLOCOverlay');">Learn More <span class="glyphicon glyphicon-circle-arrow-right"></span></a>
      <div id="popoverContent1" class="hide"><strong>Ideal for:</strong> Qualified clients who want to continue having the convenient access to funds that a home equity line of credit provides.<br /><br /><strong>What:</strong> Apply for a new Access 3<sup>&reg;</sup> Equity Line and transfer your current balance to the new line. <a target="_blank" href="https://www.suntrust.com/PersonalBanking/Loans/EquityLinesOfCreditAndLoans/EquityLineOfCredit">Learn More</a> about our Access 3<sup>&reg;</sup> Equity Line.<br /><br /><strong>Get started:</strong> <a target="_blank" href="https://www.suntrust.com/portal/server.pt?space=Redirect&amp;CommunityID=1805&amp;ui_ProdGroup=IL&amp;ui_ProdSubGroup=EQLN&amp;ui_Product=INETACCX&amp;POPNAC=T">Apply Online</a>, Call <span class="blue">877-748-4059</span>, or stop by your <a target="_blank" href="https://www.suntrust.com/FindUs">local branch</a>.
      </div>
    </div>
    <div class="col-md-4">
      <img src="money.gif" alt="Money Symbol" />
      <h4>Pay Off the<br />Current Balance</h4>
      <a href="#" id="popoverBtn2" class="popoverThis btn btn-default" data-placement='bottom' onClick="s.linkTrackVars= s.linkTrackVars+',eVar45,events'; s.events='event23'; s.linkTrackEvents='event23'; s.eVar45='MaturingEquityLines|PayOffCurrentBalanceOverlay'; s.tl(this,'o','MaturingEquityLines|PayOffCurrentBalanceOverlay');">Learn More <span class="glyphicon glyphicon-circle-arrow-right">Learn More <span class="glyphicon glyphicon-circle-arrow-right"></span></a>
      <div id="popoverContent2" class="hide"><strong>Ideal for:</strong> Clients who no longer need an equity line of credit and are in a financial position to begin repaying their balance with the new monthly payments.<br /><br /><strong>What:</strong> Begin to pay off the balance of your existing equity line of credit when the draw period ends.<br /><br /><strong>Get started:</strong> Continue to make regular payments under the repayment period terms of your existing home equity line of credit; no further action is required.
      </div>
    </div>
    <div class="col-md-4">
      <img src="note.gif" alt="Note Symbol" />
      <h4>Sign a Repayment<br />Extension</h4>
      <a href="#" id="popoverBtn3" class="popoverThis btn btn-default" data-placement='bottom' onClick="s.linkTrackVars= s.linkTrackVars+',eVar45,events'; s.events='event23'; s.linkTrackEvents='event23'; s.eVar45='MaturingEquityLines|SignRepaymentExtensionOverlay'; s.tl(this,'o','MaturingEquityLines|SignRepaymentExtensionOverlay');">Learn More <span class="glyphicon glyphicon-circle-arrow-right">Learn More <span class="glyphicon glyphicon-circle-arrow-right">Learn More <span class="glyphicon glyphicon-circle-arrow-right"></span></a>
      <div id="popoverContent3" class="hide" style="z-index:-1;"><strong>Ideal for:</strong> Clients who anticipate having a difficult time making higher monthly payments when their draw period ends.<br /><br /><strong>What:</strong> Modify your existing repayment term and extend the repayment period which allows you to make lower monthly fixed-rate payments.<br /><br /><strong>Get started:</strong> Call us at <span class="blue">888-886-0696</span>, Monday &ndash; Friday 8 am to 6 pm ET, and request a Repayment Extension.* We will mail you the extension with instructions on completing and returning it.<br /><br /><span class="dis"><em>* By submitting this request, Federal Regulations require SunTrust Bank to determine if your home is located in a Special Flood Hazard Area as designated by the FEMA Flood Maps for your community. If your home is determined to be in a flood zone A or V, you will be required to obtain and maintain acceptable flood insurance coverage for the remaining term of your equity line or loan. This requirement is not dependent upon the approval of your modification. Once a flood zone determination is made, withdrawal of the modification request will not eliminate the flood insurance requirement for zones A and V. Unfortunately a lender placed flood policy is not acceptable by law to allow us to proceed with the modification even if the agreement is executed. If at any point during the term of your line or loan we are notified that you are located in a Special Flood Hazard Area, the bank is required by Federal Law to ensure that adequate flood insurance is on file for your property.</em></span>
      </div>

我认为建议我应该从每个链接中删除此代码 s.linkTrackVars= s.linkTrackVars+',eVar45,events';

最佳答案

要跟踪点击,可以调用.tl()函数,以下是我生产环境的代码:

$(".myDiv a").on("click", function () 
{
    var pageName = $(this).text().trim();
    if (s && pageName != "") {
        s.pageName = originalPageName + ":FAQ:" + pageName
        s.tl();
    }
});

当然,这假定 s 是 Ommniture 全局变量。我还使用特定数据(直接从我的代码中获取),因此您实际上不需要设置所有这些,只需设置 pageName 或您正在捕获的任何变量。我也在使用 jQuery 作为选择器,不要让你感到困惑,你可以调用一个普通的 JavaScript 函数,然后调用 s.tl()

要调试(跟踪点击次数),请通过将以下脚本添加为浏览器的书签来使用他们的调试器:

javascript:void(window.open("","dp_debugger","width=600,height=600,location=0,menubar=0,status=1,toolbar=0,resizable=1,scrollbars=1").document.write("<script language=\"JavaScript\" id=dbg src=\"https://www.adobetag.com/d1/digitalpulsedebugger/live/DPD.js\"></"+"script>"));

只要您想跟踪 Omniture 事件,只需单击书签即可。

DigitalPulse 调试器:http://helpx.adobe.com/analytics/using/digitalpulse-debugger.html

关于javascript - 如何为点击事件实现 Omniture 自定义链接跟踪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21271112/

相关文章:

javascript - 在jquery中初始化一个函数一次

Javascript 三维数组与对象字面量

ios - 当我使用 Firebase/Google Analytics 记录事件时,如何明确设置时间戳?

javascript - 未定义源必须以 "https://"或 "//"开头

javascript - 在 Adob​​e DTM 数据元素中寻找自定义脚本(使用 jQuery 捕获内部 HTML)?

javascript - 显示开始日期小于结束日期 - Datepicker

javascript - 如何使用 AJAX 将对象数据数组插入数据库

javascript - Jquery Lightbox 2 - 单击按钮上的图像库

javascript - 从javascript中的按钮检索名称值

java - Adobe Omniture For Android在trackAction上失败