2014-01-21 70 views
3

我正在尋找在一個頁面的3個鏈接上實施Omniture自定義鏈接跟蹤代碼。我已經提供了一些JavaScript代碼,但不知道我是否需要在頁面中使用這些代碼,或者只是需要將它合併到鏈接的onclick部分。如何爲點擊事件實施Omniture自定義鏈接跟蹤?

我以前沒有這樣做,試圖在這裏(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標籤

2後s_code.js。由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項目,如示例中所示,我需要它們嗎?

無論如何通過控制檯知道鏈接是否通過點擊進行跟蹤?

感謝,

** * ** * ****UPDATE* ** * ** * ** * ** * ** * ** * ** * ** * ****

對不起看來我是因爲每個人都解釋我提供的例子,而不是我想實現的代碼之前不清楚。

這是我生成的代碼,並且想知道它是否正確。我在頁面上使用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';

回答

4

刪除此代碼要跟蹤點擊,可以撥打.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

+0

非常感謝您的調試器。我認爲這會幫助我很多。這令我非常緊張,我無法真正知道它是否有效,但現在我可以了。 –

+0

對於omniture腳本的後期運行,我建議你在Firefox Mozilla中使用HTTP Fox debbuger。 – shamshul2007

0

你的代碼是罰款,是,雖然它的清潔劑包裝在一個單獨的功能及調用該函數在你的onclick或附加通過點擊事件處理函數調用(例如,Hanlet所展示的)。

有一點需要注意的是,您可能不希望將這些增值附加到現有的s.linkTrackVars值。只要東西捲入請求,這可能會產生意想不到的後果。例如,假設您在頁面上有其他一些點擊/鏈接/自定義跟蹤(其他一些彈出s.tl調用的東西),並設置了不同的變量。如果你像這樣追加到s.linkTrackVars,並且有人已經彈出了另一個代碼,它將再次捲起那些其他變量,因爲它們會有值。

例如,假設您在頁面上有這2個鏈接。首先是定製下載跟蹤。第二屆一個是你的鏈接,您發佈的評論:

<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值將與您的第二次鏈接點擊一起彈出。

現在,在這個情況,這不是一個大問題,因爲這隻有真正影響您的報告實例的度量,沒有人真正在乎這一點。但是,如果你將這種情況擴大到任何其他的變數,那麼你應該只在特定的時間出現,這可能會導致通貨膨脹。

所以這裏的外賣是通常你不應該追加到linkTrackVars,除非你知道你在做什麼或已經評估過這種情況,並且已經確定它不會無意中誇大其他變量。

0

由於您正在使用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代碼。

+2

如果您使用的是Firebug,它有一個名爲omnibug(google it)的擴展,它爲omniture(和其他分析跟蹤,例如webtrends,google analytics)添加了一個選項卡。我發現使用它比使用net標籤更容易,因爲它只顯示這些請求並給你一些友好的格式。國際海事組織比數字脈衝更好,因爲你必須刷新數字脈衝後,每次看到新的請求 –

+0

我不知道有關全部擴展。這對我來說會讓事情變得更加簡單,謝謝你們! –

+2

只是在這裏說「把你的東西搞砸吧,擰你的土坯,你的分析工具是一個陳舊的POS,沒有人喜歡你,走開。 – the0ther