簡體   English   中英

如何在點擊事件上實現Omniture自定義鏈接跟蹤?

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

我想在一個頁面的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項目,我需要它們嗎?

無論如何通過控制台知道是否在點擊時跟蹤鏈接?

謝謝,

** * ** * **** 更新 * ** * ** * ** * ** * ** * ** * ** * ** * ****

對不起似乎我之前不清楚,因為每個人都在解釋我提供的示例,而不是我試圖實現的代碼。

這是我制作的代碼,我想知道它是否正確。 我在頁面上使用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

你的代碼很好,雖然將它包裝在一個單獨的函數中並在你的onclick中調用函數或通過click事件處理程序附加函數調用(例如Hanlet顯示的內容)更清晰。

需要注意的一點是,您可能不希望將這些變量附加到現有的s.linkTrackVars值。 就填充到請求中的內容而言,這可能會產生意想不到的后果。 例如,假設您在頁面上有一些其他點擊/鏈接/自定義跟蹤(其他一些彈出s.tl調用的東西),並設置了不同的變量。 如果你附加到這樣的s.linkTrackVars並且有人已經彈出了其他代碼,那么它將再次卷起其他變量,因為它們會有值。

例如,假設您在頁面上有這兩個鏈接。 第一個是自定義下載跟蹤。 第二個是您發布的鏈接:

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

如果首先單擊下載鏈接, linkTrackVars將附加eVar1 ,您將為eVar1一個值。 然后讓我們說你點擊第二個鏈接。 因為您要向linkTrackVars附加更多值而不是僅設置相關變量, eVar1值將隨着第二次鏈接點擊一起彈出。

現在,在這種情況下,這不是什么大問題,因為這只會影響您報告中的實例指標,並且沒有人真正關心這一點。 但是,如果你將這個場景擴展到任何其他vars,你碰巧設置了只應該在特定時間彈出,那么這可能會導致一些通貨膨脹。

所以這里的內容是通常你不應該附加到linkTrackVars除非你知道你正在做什么或已經評估了情況,並確定它不會無意中膨脹其他變量。

由於您正在使用tl()調用,這是一個部分數據調用。 意思是,不是整頁加載/調用。 所以,基本上你是在發送一個數據子集。 在我的使用中,我通常不會附加linkTrackVars,除非你想再次跟蹤它們。

所以,這似乎是合適的。

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

您可以獲取調試器而不是Hanlet建議,或者只使用firefox調試器。 查看“網絡”並搜索“指標”,或獲取httpwatch - 並看到你的通話結束。

注意:我假設您使用的是jQuery,因此我使用該約定來處理鏈接的事件。 如果你沒有jQuery,你可以使用原生的js代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM