Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Does getPageLoadTime plugin measure current or previous page load time

Avatar

Level 2

Maybe this is just a weird interpretation on my part, but is the getPageLoadTime plugin measuring the page load time for the page a user is currently on or the page load time for the previous page a user was on.  
https://experienceleague.adobe.com/docs/analytics/implementation/vars/plugins/getpageloadtime.html?l...

I am reading this as the value set for s_plt is the previous page's load time.

The getPageLoadTime method does not use any arguments. When calling this method, it does not return anything. Instead, it sets the following variables:

  • s._pltPreviousPage: The previous page so you can correlate load time to the previous page
  • s._pltLoadTime: The time in seconds that the previous page took to load

The getPageLoadTime plug-in creates two first-party cookies:

  • s_plt: The time, in seconds, that the previous page took to load. Expires at the end of the browser session.
  • s_pltp The value of the s.pageName variable as recorded in the previous Adobe Analytics image request. Expires at the end of the browser session.

However, when I run some additional page load time tests the current page I am on reads the same as the value getting sent to s_plt. 
Am I reading the plugin correctly, or is the value for s_plt actually the time it takes for the current page a user is on to finish loading? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I admit that I haven't used this plugin in a long time, but my understanding all along is that it records the page load time of the previous page. So when you set your prop/eVar with the page load time, you also need to set a corresponding prop/eVar with the previous page's name, so that you can pair both of them together to get the correct report.

Also, after reading the plugin's code, I believe this is is how it works:

  • When the page loads:
    • If the 2 cookies are found, then set s._pltPreviousPage and s._pltLoadTime from them. --> so these are the values for the previous page.
  • Calculate the page load time of the current page.
  • Write the 2 cookies with the current page's load time and page name.

As you can see in that last step, that's why you're seeing the current page's name in the cookie value, because by then, the plugin has already overwritten the cookies with the current page's data.

Theoretically, that means if you want to set the current page's load time with the current page's Pageview tag, then you could read the cookies directly to set your props/eVars. But you'll need to delay firing your Pageview tag till the Window Loaded event, so that the browser has calculated the load time completely. I haven't tried that myself, but it looks like that could work.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

I admit that I haven't used this plugin in a long time, but my understanding all along is that it records the page load time of the previous page. So when you set your prop/eVar with the page load time, you also need to set a corresponding prop/eVar with the previous page's name, so that you can pair both of them together to get the correct report.

Also, after reading the plugin's code, I believe this is is how it works:

  • When the page loads:
    • If the 2 cookies are found, then set s._pltPreviousPage and s._pltLoadTime from them. --> so these are the values for the previous page.
  • Calculate the page load time of the current page.
  • Write the 2 cookies with the current page's load time and page name.

As you can see in that last step, that's why you're seeing the current page's name in the cookie value, because by then, the plugin has already overwritten the cookies with the current page's data.

Theoretically, that means if you want to set the current page's load time with the current page's Pageview tag, then you could read the cookies directly to set your props/eVars. But you'll need to delay firing your Pageview tag till the Window Loaded event, so that the browser has calculated the load time completely. I haven't tried that myself, but it looks like that could work.