Expand my Community achievements bar.

SOLVED

Not able to implement scroll tracking for the long page in DTM.

Avatar

Level 3

Hi team,

Iam trying to implement scroll tracking for netapp.com pages. Referred one of your question (http://help-forums.adobe.com/content/adobeforums/en/marketing-cloud-forum/activation.topic.html/foru...) and implement the same.But it is not working. Any thoughts?

Regards,

Vidya

1 Accepted Solution

Avatar

Correct answer by
Level 3

ParitMittal wrote...

Hi Vidya ,

As mentioned on the https://learnomics.wordpress.com/2014/12/14/track-dynamic-content-while-scrolling-the-page-to-bottom....

Creating an Event based rule with Event Type "Enters View Port" is the Right method to Implement the same . Can you Please share your DTM Account details in a private message as well as Test URL of the Website so that we can debug the rule you created at our end.

Thanks & Regards

Parit Mittal

 

View solution in original post

6 Replies

Avatar

Level 10

Hi Vidya, 

Please follow the below instructions to implement Scroll tracking through the Percentage Page Viewed plugin . 

For  capturing the scroll of page , It is required to use  percentage page viewed plugin.  Please note that the plugin Record the portion of a page (0-100%) that the user views and pass the value into a variable on the next page view.

Ex- If user views a page say " Page A" and scrolls till  70% of the page and then clicks on a link on "Page A" and moves to "Page B" . Hence on load of "Page B", The Percentage of Page view value captured for "Page A" is 70%.

Please follow the following steps and you will be good to go with percentage page viewed plugin.

  • Add plug in code to s_code / App measurement.js  file in plugins section.

 

/*plugin to capture previous value */ s.getPreviousValue=new Function("v","c","el","" +"var s=this,t=new Date,i,j,r='';t.setTime(t.getTime()+1800000);if(el" +"){if(s.events){i=s.split(el,',');j=s.split(s.events,',');for(x in i" +"){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t)" +":s.c_w(c,'no value',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?" +"s.c_w(c,v,t):s.c_w(c,'no value',t);return r}"); /* * Utility Function: split v1.5 - split a string (JS 1.0 compatible) */ s.split=new Function("l","d","" +"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x" +"++]=l.substring(0,i);l=l.substring(i+d.length);}return a"); s.getPercentPageViewed=new Function("n","" +"var s=this,W=window,EL=W.addEventListener,AE=W.attachEvent,E=['load" +"','unload','scroll','resize','zoom','keyup','mouseup','touchend','o" +"rientationchange','pan'];W.s_Obj=s;s_PPVid=(n=='-'?s.pageName:n)||s" +".pageName||location.href;if(!W.s_PPVevent){s.s_PPVg=function(n,r){v" +"ar k='s_ppv',p=k+'l',c=s.c_r(n||r?k:p),a=c.indexOf(',')>-1?c.split(" +"',',10):[''],l=a.length,i;a[0]=unescape(a[0]);r=r||(n&&n!=a[0])||0;" +"a.length=10;if(typeof a[0]!='string')a[0]='';for(i=1;i<10;i++)a[i]=" +"!r&&i<l?parseInt(a[i])||0:0;if(l<10||typeof a[9]!='string')a[9]='';" +"if(r){s.c_w(p,c);s.c_w(k,'?')}return a};W.s_PPVevent=function(e){va" +"r W=window,D=document,B=D.body,E=D.documentElement,S=window.screen|" +"|0,Ho='offsetHeight',Hs='scrollHeight',Ts='scrollTop',Wc='clientWid" +"th',Hc='clientHeight',C=100,M=Math,J='object',N='number',s=W.s_Obj|" +"|W.s||0;e=e&&typeof e==J?e.type||'':'';if(!e.indexOf('on'))e=e.subs" +"tring(2);s_PPVi=W.s_PPVi||0;if(W.s_PPVt&&!e){clearTimeout(s_PPVt);s" +"_PPVt=0;if(s_PPVi<2)s_PPVi++}if(typeof s==J){var h=M.max(B[Hs]||E[H" +"s],B[Ho]||E[Ho],B[Hc]||E[Hc]),X=W.innerWidth||E[Wc]||B[Wc]||0,Y=W.i" +"nnerHeight||E[Hc]||B[Hc]||0,x=S?S.width:0,y=S?S.height:0,r=M.round(" +"C*(W.devicePixelRatio||1))/C,b=(D.pageYOffset||E[Ts]||B[Ts]||0)+Y,p" +"=h>0&&b>0?M.round(C*b/h):0,O=W.orientation,o=!isNaN(O)?M.abs(o)%180" +":Y>X?0:90,L=e=='load'||s_PPVi<1,a=s.s_PPVg(s_PPVid,L),V=function(i," +"v,f,n){i=parseInt(typeof a==J&&a.length>i?a[i]:'0')||0;v=typeof v!=" +"N?i:v;v=f||v>i?v:i;return n?v:v>C?C:v<0?0:v};if(new RegExp('(iPod|i" +"Pad|iPhone)').exec(navigator.userAgent||'')&&o){o=x;x=y;y=o}o=o?'P'" +":'L';a[9]=L?'':a[9].substring(0,1);s.c_w('s_ppv',escape(W.s_PPVid)+" +"','+V(1,p,L)+','+(L||!V(2)?p:V(2))+','+V(3,b,L,1)+','+X+','+Y+','+x" +"+','+y+','+r+','+a[9]+(a[9]==o?'':o))}if(!W.s_PPVt&&e!='unload')W.s" +"_PPVt=setTimeout(W.s_PPVevent,333)};for(var f=W.s_PPVevent,i=0;i<E." +"length;i++)if(EL)EL(E[i],f,false);else if(AE)AE('on'+E[i],f);f()};v" +"ar a=s.s_PPVg();return!n||n=='-'?a[1]:a");
  • Add below code in the doplugins() function to s_code /App Meaurement file for capturing  getPercentPageView, get previous value in respective s.prop variable  Alternatively you can also add the below code to an existing Global page load rule or Custom page code of Adobe Analytics tool.
    1. s.usePlugins=true function s_doPlugins(s) { s.prop9 = s.getPreviousValue(s.pageName,'s_ppn'); //prop9: prev page name s.prop10 = s.getPercentPageViewed(); //prop10: max % viewed of prev page if(!s.prop9||s.prop10=='no value')s.prop10=''; //clear max % viewed if no prev page view } s.doPlugins=s_doPlugins
  • Create a report by breaking down prop9 with prop10 and add traffic metrics to the report.

Please let us know in case of any questions or queries.

Thanks & Regards

Parit Mittal

Avatar

Level 3

Thank you so much Parit for the detailed description. I appreciate.  Let me try this. I will let you know if this is working.

Regards,

Vidya

Avatar

Level 3

Hi Parit,

The solution that you have given is working perfectly fine but the stakeholder is asking if i can track the content sections while scrolling.

He has given me this page which doesn't belong to our company https://www.bcbsnc.com/content/plans/individual-insurance.htm. If you scroll this page after each content section there is a analytics call.

How can we implement this? Any directions would be helpful.

Regards,

Vidya

Avatar

Level 3

Hi Parit,

 

I tried this https://learnomics.wordpress.com/2014/12/14/track-dynamic-content-while-scrolling-the-page-to-bottom.... But it is not working. I added different class to each section. But it is not working.

Any thoughts?

Vidya

Avatar

Level 10

Hi Vidya ,

As mentioned on the https://learnomics.wordpress.com/2014/12/14/track-dynamic-content-while-scrolling-the-page-to-bottom....

Creating an Event based rule with Event Type "Enters View Port" is the Right method to Implement the same . Can you Please share your DTM Account details in a private message as well as Test URL of the Website so that we can debug the rule you created at our end.

Thanks & Regards

Parit Mittal

Avatar

Correct answer by
Level 3

ParitMittal wrote...

Hi Vidya ,

As mentioned on the https://learnomics.wordpress.com/2014/12/14/track-dynamic-content-while-scrolling-the-page-to-bottom....

Creating an Event based rule with Event Type "Enters View Port" is the Right method to Implement the same . Can you Please share your DTM Account details in a private message as well as Test URL of the Website so that we can debug the rule you created at our end.

Thanks & Regards

Parit Mittal