Creating a calculated metric with getPercentPageViewed value | Community
Skip to main content
curtis_pond
Level 3
June 19, 2024
Solved

Creating a calculated metric with getPercentPageViewed value

  • June 19, 2024
  • 1 reply
  • 1639 views

Hi There!

I'm using the getPercentPageViewed plug-in. I'm writing the value to a prop.

The values for any page come in as 100, 99, 98 and so on. We have a lot of long-scrolling pages on our site.

I'm hoping to build a calculated metric, specifically get the AVG percent viewed for each page on my site. 

I've been trying to build a metric by using the MEAN function and then dropping in the prop. 

It says that I need to add a metric, but not quite sure what that means.

Any guidance on how to do this? 
Thank you!

Curtis

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

Hi @curtis_pond 

the getPercentViewed values you are passing in as prop or eVar are custom dimensions, meaning text values and not numbers / metrics. That is why you cannot use props or eVars in your case.

 

this is also what you are seeing in the examples here https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/plugins/getpercentpageviewed 

 

what may be an alternative approach could be using classifications to create buckets of scroll depth e.g., 0-25%, 26-50%, 51-75%, >75%

 

These are the classification rule regexes I typically use for this

  • ^(\d|1\d|2[0-5])$
  • ^(2[6-9]|[34]\d|50)$
  • ^(5[1-9]|6\d|7[0-5])$
  • ^(7[6-9]|[89]\d|100)$

it will not generate averages, but good enough to draw conclusions from it.

 

Hope that helps

 

P.S. haven't tried dedicated event values e.g., event99=50 which will actually increase that metric by 50, which would theoretically create the base for a calculated metric you were initially looking for. Would be interesting to hear if anyone made this work

1 reply

bjoern__koth
Community Advisor and Adobe Champion
bjoern__kothCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
June 19, 2024

Hi @curtis_pond 

the getPercentViewed values you are passing in as prop or eVar are custom dimensions, meaning text values and not numbers / metrics. That is why you cannot use props or eVars in your case.

 

this is also what you are seeing in the examples here https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/plugins/getpercentpageviewed 

 

what may be an alternative approach could be using classifications to create buckets of scroll depth e.g., 0-25%, 26-50%, 51-75%, >75%

 

These are the classification rule regexes I typically use for this

  • ^(\d|1\d|2[0-5])$
  • ^(2[6-9]|[34]\d|50)$
  • ^(5[1-9]|6\d|7[0-5])$
  • ^(7[6-9]|[89]\d|100)$

it will not generate averages, but good enough to draw conclusions from it.

 

Hope that helps

 

P.S. haven't tried dedicated event values e.g., event99=50 which will actually increase that metric by 50, which would theoretically create the base for a calculated metric you were initially looking for. Would be interesting to hear if anyone made this work

Cheers from Switzerland!
curtis_pond
Level 3
June 20, 2024

Thank you, @bjoern__koth . I started exploring your suggestion yesterday and this looks like it might work. I appreciate you taking the time to provide your input and the background on custom dimensions. Thanks much!