简体   繁体   English

如何在点击事件上实现Omniture自定义链接跟踪?

[英]How to implement Omniture custom link tracking for on click event?

I'm looking to implement Omniture custom link tracking code on 3 links of one page. 我想在一个页面的3个链接上实现Omniture自定义链接跟踪代码。 I've been provided some javascript code but not sure if I need this in the page or if I just need to incorporate it into the onclick portion of the link. 我已经提供了一些javascript代码但不确定我是否需要在页面中使用它,或者我只是需要将它合并到链接的onclick部分。

I have not done this before and have tried to read up on it here ( http://microsite.omniture.com/t2/help/en_US/sc/implement/oms_sc_implement.pdf ) and here ( https://developer.omniture.com/en_US/content_page/sitecatalyst-tagging/c-add-a-custom-link ) but it does not make much sense to me. 我之前没有这样做,并试图在这里阅读( 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 )但对我来说没有多大意义。

Here's is what I have done so far: 这是我到目前为止所做的:

  1. Included link to s_code.js after opening body tag 打开body标签后包含s_code.js的链接

2 . 2。 Grab code that was provided by Omniture to track one of the links 抓取Omniture提供的代码来跟踪其中一个链接

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

3 . 3。 Reviewed an example of Omniture custom link tracking 查看了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>

I think from comparing, that my links should be coded like this: 我认为通过比较,我的链接应该像这样编码:

<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>

Does that seem correct? 这看起来是否正确? Do I need to include the scripts from #2. 我是否需要包含#2中的脚本。 somewhere else on the page for it to track the links? 在页面的其他地方,它可以跟踪链接?

The code provided to me did not have any s.prop items as seen in the example, do I need them? 提供给我的代码没有示例中所示的任何s.prop项目,我需要它们吗?

Is there anyway to know via the console if the links are tracked on click? 无论如何通过控制台知道是否在点击时跟踪链接?

Thanks, 谢谢,

** * ** * **** UPDATE * ** * ** * ** * ** * ** * ** * ** * ** * **** ** * ** * **** 更新 * ** * ** * ** * ** * ** * ** * ** * ** * ****

Sorry seems I was unclear before since everyone is explaining the example I was provided and not the code I am trying to implement. 对不起似乎我之前不清楚,因为每个人都在解释我提供的示例,而不是我试图实现的代码。

This is the code I have produced and am wondering if it is correct. 这是我制作的代码,我想知道它是否正确。 I am using jQuery on the page. 我在页面上使用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>

I think it is suggested I should remove this code from each link s.linkTrackVars= s.linkTrackVars+',eVar45,events'; 我认为我建议我应该从每个链接中删除此代码s.linkTrackVars= s.linkTrackVars+',eVar45,events';

To track the clicks, you may call the .tl() function, the following is code from my production environment: 要跟踪点击次数,您可以调用.tl()函数,以下是我的生产环境中的代码:

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

This of course, assumes that s is the Ommniture global variable. 当然,这假设s是Ommniture全局变量。 I am also using specific data (got this directly from my code), so you don't really need to set all of that up, just the pageName, or whichever variable you are capturing. 我也在使用特定的数据(直接从我的代码中获取),所以你真的不需要设置所有这些,只需要设置pageName,或者你捕获的任何变量。 I am also using jQuery for the selector, do not let that confuse you, you can just call a normal JavaScript function, and call s.tl() . 我也使用jQuery作为选择器,不要让你迷惑,你可以调用一个普通的JavaScript函数,并调用s.tl()

To debug (track the clicks), use their debugger by adding the following script as a Bookmark for your browser: 要调试(跟踪点击次数),请使用他们的调试器,将以下脚本添加为浏览器的书签:

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>"));

Just click the Bookmark whenever you want to track Omniture events. 只要您想跟踪Omniture事件,只需单击书签即可。

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

your code is fine as-is, though it's cleaner to wrap it in a separate function and call the function in your onclick or attach the function call via a click event handler (eg what Hanlet showed). 你的代码很好,虽然将它包装在一个单独的函数中并在你的onclick中调用函数或通过click事件处理程序附加函数调用(例如Hanlet显示的内容)更清晰。

One thing to note is that you may not really want to append those vars to the existing s.linkTrackVars value. 需要注意的一点是,您可能不希望将这些变量附加到现有的s.linkTrackVars值。 This may produce unintended consequences as far as stuff getting rolled up into the request. 就填充到请求中的内容而言,这可能会产生意想不到的后果。 For example, let's say you have some other click/link/custom tracking on the page (some other thing that pops an s.tl call) with different variables being set. 例如,假设您在页面上有一些其他点击/链接/自定义跟踪(其他一些弹出s.tl调用的东西),并设置了不同的变量。 If you append to s.linkTrackVars like that and someone already popped the other code, it's going to roll up those other vars again since they would have values. 如果你附加到这样的s.linkTrackVars并且有人已经弹出了其他代码,那么它将再次卷起其他变量,因为它们会有值。

Example, let's say you have these 2 links on a page. 例如,假设您在页面上有这两个链接。 First one is for custom download tracking. 第一个是自定义下载跟踪。 2nd one is your link you posted: 第二个是您发布的链接:

<a href='someFile.pdf' onclick="s.eVar1='some widget';s.linkTrackVars+=',eVar1';s.tl(this,'o','file downloaded');return false;">some file</a>

<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>

If you click the download link first, linkTrackVars will have eVar1 appended to it, and you will be giving eVar1 a value. 如果首先单击下载链接, linkTrackVars将附加eVar1 ,您将为eVar1一个值。 Then let's say you click the 2nd link. 然后让我们说你点击第二个链接。 Because you are appending more values to linkTrackVars instead of only setting relevant vars, eVar1 value is going to be popped along with your 2nd link click. 因为您要向linkTrackVars附加更多值而不是仅设置相关变量, eVar1值将随着第二次链接点击一起弹出。

Now, in this case, that's not a big deal because this only really affects the instance metric in your reporting, and nobody really cares about that. 现在,在这种情况下,这不是什么大问题,因为这只会影响您报告中的实例指标,并且没有人真正关心这一点。 But if you expand this scenario to any other vars you happen to have set that should only be popped at specific times, well this could make for some inflation. 但是,如果你将这个场景扩展到任何其他vars,你碰巧设置了只应该在特定时间弹出,那么这可能会导致一些通货膨胀。

So the takeaway here is that normally you shouldn't append to linkTrackVars unless you know what you're doing or have evaluated the situation and have determined it's not going to inadvertently inflate other vars. 所以这里的内容是通常你不应该附加到linkTrackVars除非你知道你正在做什么或已经评估了情况,并确定它不会无意中膨胀其他变量。

Since you are using the tl() call, that is a partial data call. 由于您正在使用tl()调用,这是一个部分数据调用。 Meaning, not a full page load/call. 意思是,不是整页加载/调用。 So, basically you are sending a subset of data. 所以,基本上你是在发送一个数据子集。 In my usage, I usually don't append the linkTrackVars unless you want to track them too, again. 在我的使用中,我通常不会附加linkTrackVars,除非你想再次跟踪它们。

So, this seems appropriate. 所以,这似乎是合适的。

<a href="#" id="community_overlay_trigger" class="delicious">delicious</a>


jQuery('#community_overlay_trigger').bind('click', function(event){
       s.linkTrackVars = 'events,eVar8,prop8,prop13';
       s.linkTrackEvents='event6'
       s.events='event6';
       s.eVar8=s.prop8='delicious';
       s.prop13=s.pageName || "no pagename given";
       s.tl(this, 'o', 'Content Share');
       event.preventDefault(); // or return false here
})

You can grab the debugger than Hanlet suggests, or just use firefox debugger. 您可以获取调试器而不是Hanlet建议,或者只使用firefox调试器。 look on "net" and search for "metrics", or get httpwatch - and see your call going out. 查看“网络”并搜索“指标”,或获取httpwatch - 并看到你的通话结束。

note: I am assuming you are using jQuery, so I use that convention for event handling of the link. 注意:我假设您使用的是jQuery,因此我使用该约定来处理链接的事件。 If you don't have jQuery, you can just use native js code. 如果你没有jQuery,你可以使用原生的js代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM