Expand my Community achievements bar.

SOLVED

Is there a way to track site speed?

Avatar

Level 1

Hi,
I want to know if there is a way to track site speed in Adobe Analytics. I saw this question, but the Adobe plug-in: getPageLoadTime is no longer supoported, so I want to know if there's another way to track it

Thanks!

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor and Adobe Champion

Not really, not reliably anyway...

 

I suppose you could try creating a variable with a timestamp as soon as the Adobe Library is loaded (this will miss all the load time of your site prior to your files to start loading in), then at the Window Loaded event, get another timestamp and calculate the different between them... 

 

Unfortunately the performance metrics that the plugin leveraged have been deprecated by the browsers, so the only solutions left will be sort of "hacky"....

View solution in original post

11 Replies

Avatar

Correct answer by
Community Advisor and Adobe Champion

Not really, not reliably anyway...

 

I suppose you could try creating a variable with a timestamp as soon as the Adobe Library is loaded (this will miss all the load time of your site prior to your files to start loading in), then at the Window Loaded event, get another timestamp and calculate the different between them... 

 

Unfortunately the performance metrics that the plugin leveraged have been deprecated by the browsers, so the only solutions left will be sort of "hacky"....

Avatar

Community Advisor

Hi @Katia_MacedaXM 

if you need detailed reports, you could play around with the Web Vitals extension, but as it also states, since the needed library is loaded through the extension itself, some measured timing data will be affected.

https://exchange.adobe.com/apps/ec/106769/web-vitals

 

This should give you some starting point at least. Bear in mind though that this data should not be sent in an individual analytics call, since this would affect your bounce rate (unlike Google, Adobe has unfortunaltely never managed to implement something similar to "non-interaction hits").

 

If you are only interested in how long a page needed to load, you could use the PerformanceTiming API that is built-in all modern browsers.

 

window.addEventListener('load', () => {
  const [performanceTiming] = performance.getEntriesByType('navigation');
  console.log(`Page Load Time: ${performanceTiming.loadEventEnd - performanceTiming.startTime} ms`);
});

 

 

Cheers from Switzerland!


Avatar

Community Advisor and Adobe Champion

Lol, technically, I don't even use Adobe's default "Bounces" or "Bounce Rate"... we set up custom metrics based on "Single Page Visits", since there is too many potential actions on the page... Basing a bounce on a single hit was a problem for us...

 

But, I do agree that you likely want to combine any data onto a single call, even if just to reduce your server call usage... if you are tracking timing as separate calls then you will almost double your server call usage, as every page would have a secondary "timing" call... not ideal.

Avatar

Community Advisor and Adobe Champion

@bjoern__koth The PerformanceTimingAPI is deprecated.. this is what the Adobe Plugin used, and that deprecation is the reason that the Adobe Plugin is no longer supported:

Jennifer_Dungan_0-1739457021508.png

 

 

 

Oh it looks like a replacement (that hasn't been picked up by all browsers) has been added: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming

So you might be able to use this with a fallback on the old Performance timers?

Avatar

Community Advisor

Lol, interesting, I was fairly certain that this API would still be in use. Guess I am getting old...

 

So, this seems to work:

  • create a Core - Window loaded rule
  • add a custom code action
const [navTiming] = performance.getEntriesByType('navigation');

const metrics = {
  redirectTime: navTiming.redirectEnd - navTiming.redirectStart,
  dnsLookupTime: navTiming.domainLookupEnd - navTiming.domainLookupStart,
  tcpConnectionTime: navTiming.connectEnd - navTiming.connectStart,
  requestTime: navTiming.responseEnd - navTiming.requestStart,
  domProcessingTime: navTiming.domComplete - navTiming.domInteractive,
  pageLoadTime: navTiming.loadEventEnd - navTiming.startTime,
};

_satellite.logger.debug(">>> Page Speed Metrics:", metrics);

 

will look something like this

bjoern__koth_0-1739479132485.png

 

Cheers from Switzerland!


Avatar

Community Advisor and Adobe Champion

Yeah, when it was deprecated it was certainly interesting.. and at that time there was no alternative posted... at least there is a replacement, but it's not fully adopted by all browsers yet... 

 

Nice code, but best to check that this functions on the majority of browsers that visit your site before fully adopting the solution.

Avatar

Level 6

@Katia_MacedaXM 

 

Hi @Katia_MacedaXM I have used below script get the page-load speed and it is absolutely working fine for me.


s.doPlugins=function(s) {
if(s.pageName) s.getPageLoadTime();
if(s._pltPreviousPage){
s.prop9 = s._pltLoadTime;
s.events=s.apl(s.events,"event14="+ s._pltLoadTime,",",1);
}

}
s.usePlugins =true;

Amruthesh_AG_1-1739430169631.png

 

Avatar

Community Advisor and Adobe Champion

@Amruthesh_AG this is the plugin that is no longer supported... that uses https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming which has been deprecated in most modern browsers... you will only be getting a subset of your traffic, and as more browsers update, that subset will get smaller and smaller.

Avatar

Level 6

@Jennifer_Dungan  Thanks for the update.

Avatar

Level 6

@Katia_MacedaXM  have tried this below extension Accessible Site Speed Metrics.

It is having some good insights.

https://exchange.adobe.com/apps/ec/103053

 

Avatar

Community Advisor and Adobe Champion

While I can't see the code for this extension, I suspect this relies on the same deprecated PerformanceTiming given the date it was published (September 23, 2019). I don't see any updates indicating that they have updated recently to use the newer PerformanceNavigationTiming standard (or leverage both for older and newer browsers based on what standard is supported).