Percentage Viewed Plugin | Community
Skip to main content
Level 3
July 4, 2024
Question

Percentage Viewed Plugin

  • July 4, 2024
  • 2 replies
  • 1031 views

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.

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

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

 

Thanks!!

Bindu Kumari

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 4, 2024

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

 

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.

 

 

with a concrete example

 

 

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

 

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

 

Cheers from Switzerland!
ezhil_raja
Level 4
July 4, 2024

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-installation-within-websdk/td-p/613001

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 4, 2024

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 

Cheers from Switzerland!