Expand my Community achievements bar.

Percentage Viewed Plugin

Avatar

Level 3

Hi,

Currently I am working on migration from AA extension to AEP extension, so we are using percentage view plugin to get percentage view, but this plugin is not supported in AEP extension. So, I have use this code in custom code in the rule.

bindukumari90_0-1720080973040.png

And, I have created custom variable for pageview custom, it is working but sometime it shows negative value i.e.

bindukumari90_0-1720083593161.png

I don't understand the reason behind it any inputs will be appreciated.

 

Thanks!!

Bindu Kumari

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 9

Hi @bindukumari90 

this here works for me

 

A Rule the fires on library loaded with a custom code action that includes the plugin (you can get the code from the plugin page in the documentation)

 

https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/plugins/getpercentpageviewe...

 

bjoern__koth_0-1720097941471.png

bjoern__koth_1-1720097973926.png

NOTE: I changed the code slightly to run in a window scope. The code from the plugin page is only defined as a regular function that cannot be executed outside of this action.

 

Then, in your page view rule, add a custom code before the tracking call is sent

 

 

if (typeof window.getPercentPageViewed === "function") {
  window.getPercentPageViewed();
} else {
  _satellite.logger.debug(">>> window.getPercentPageViewed NOT defined");
}

 

 

 

Define data elements for the previous page data, all as JavaScript variables e.g.

 

bjoern__koth_6-1720098143714.png

 

with a concrete example

 

bjoern__koth_4-1720098122201.png

 

in your data mapping for the page view call, map the previous scroll information

bjoern__koth_3-1720098090984.png

 

Works like a charm for me, let me know you have questions 

 

Avatar

Level 4

getPercentPageViewed plug-in is not yet supported for use within the Web SDK, and I suggest you refer to Jennifer_Dungan's answer here https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/percent-page-load-install...

Avatar

Level 9

Hi @ezhil_raja 

the plugin code can easily be used since it has no connection to the WebSDK and is just persisting the scroll information in a cookie