How do I improve my SXA sites Google PageSpeed Insights Score?Sitecore pre-fetch cache setting clarificationSXA multisite questionSXA Google Analytics tracking enableHow to display page list based on query against a dynamic sxatag valueSharing SXA Placeholder Settings over sitesAdding scaffolding PowerShell scripts after Branch creation in SXAHow can I get SXA login working with my Federated Authentication via IdentityServer?
Job offer without any details but asking me to withdraw other applications - is it normal?
Tall red piece with coffee cup, phone and gas picture?
Was Robin Hood's point of view ethically sound?
Babysitting dragons
Is there a sentence that begins with “them”?
Are the definite and indefinite integrals actually two different things? Where is the flaw in my understanding?
How can a resurrection system prevent the cheapening of death?
How do I politely hint customers to leave my store, without pretending to need leave store myself?
SCOTUS - Can Congress overrule Marbury v. Madison by statute?
Are there take-over requests from autopilots?
How does Vivi differ from other Black Mages?
Are there any instances of members of different Hogwarts houses coupling up and marrying each other?
A medieval fantasy adventurer lights a torch in a 100% pure oxygen room. What happens?
Is there a standard terminology for female equivalents of terms such as 'Kingdom' and if so, what are the most common terms?
Is English tonal for some words, like "permit"?
Can I say "I have encrypted something" if I hash something?
Kingdom Map and Travel Pace
Georgian capital letter “Ⴒ” (“tar”) in pdfLaTeX
How seriously should I take a CBP interview where I was told I have a red flag and could only stay for 30 days?
Why do sellers care about down payments?
Is there a star over my head?
Stack class in Java 8
Why does F + F' = 1?
Is the space of Radon measures a Polish space or at least separable?
How do I improve my SXA sites Google PageSpeed Insights Score?
Sitecore pre-fetch cache setting clarificationSXA multisite questionSXA Google Analytics tracking enableHow to display page list based on query against a dynamic sxatag valueSharing SXA Placeholder Settings over sitesAdding scaffolding PowerShell scripts after Branch creation in SXAHow can I get SXA login working with my Federated Authentication via IdentityServer?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Our client would like us to aim/achieve a particular Google PageSpeed Insights score. In particular, a score equal to or above 80/100 (mobile score) would be ideal.
We are building the site with SXA, how do we get anywhere near that score?
https://developers.google.com/speed/pagespeed/insights/
sxa performance-optimization performance
add a comment |
Our client would like us to aim/achieve a particular Google PageSpeed Insights score. In particular, a score equal to or above 80/100 (mobile score) would be ideal.
We are building the site with SXA, how do we get anywhere near that score?
https://developers.google.com/speed/pagespeed/insights/
sxa performance-optimization performance
add a comment |
Our client would like us to aim/achieve a particular Google PageSpeed Insights score. In particular, a score equal to or above 80/100 (mobile score) would be ideal.
We are building the site with SXA, how do we get anywhere near that score?
https://developers.google.com/speed/pagespeed/insights/
sxa performance-optimization performance
Our client would like us to aim/achieve a particular Google PageSpeed Insights score. In particular, a score equal to or above 80/100 (mobile score) would be ideal.
We are building the site with SXA, how do we get anywhere near that score?
https://developers.google.com/speed/pagespeed/insights/
sxa performance-optimization performance
sxa performance-optimization performance
asked 9 hours ago
TomTTomT
6522 silver badges13 bronze badges
6522 silver badges13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
From numerous experiments, I have put together the following tips and tricks.
Note that a good score under the desktop tab is considerably easier to achieve, the mobile score in our responsive sites is the real score we should benchmark against.
Backend Vs Front End
Page speed can be divided into two distinct parts. Backend server response and front end structure.
To get close to that desired score you need to get both working well together. I found the following to have the biggest impact:
Backend:
- Sitecore HTML Cache / Rendering Cache (tuned)
- Adequately sized servers.
- Image optimisation processor (Dianoga still seems widely used).
- Throw in a CDN for your media library for good measure.
- With SXA turning on the optimizer is a must for production and will improve the google analytics score (to a point) but the component-based nature of an SXA build will still likely result in many CSS and JS files.
Front End:
- Responsive images
- Lazy loaded images
Critical CSS in combination with deferred stylesheets. (this comes with challenges, but can be achieved.)
Deferred Javascript (this also comes with challenges, but can be achieved.)
Javascript deferral
Large amounts of JS code, in particular, has a big impact on page speed score when it's not deferred. Javascript is parsed and compiled in the browser and this has a load time cost.
Deferring Javascript does require a good working knowledge of SXA and the javascript code in the components. To get maximum benefit I found that the javascript files had to be deferred for 5 - 10 seconds depending on the site. This was so that the Lighthouse audit does not consider them part of the main page load. During this time some interactions on the page are not available, as they only kick in when the javascript finishes loading. This is where a working knowledge of javascript comes in as you may need code in some vanilla javascript that provides a nice experience until the deferred load completes. For example: fading in a clickable drop downlink.
Ensuring Load Order
This page contains a script that will allow you to defer javascript while still guaranteeing the execution order of the SXA javascript files inserted. Given that some of the OOTB SXA modules appear to be based on Jquery this is fairly important as the JQuery object needs to be available before other files load.
SXA JS Bootup
Furthermore, because the page load completed event may have already triggered before a deferred SXA Javascript file is loaded your code may need to have a bootup fallback. I found the following pattern to work in both deferred and non-deferred scenarios.
api.isRunning = false;
api.init = function ()
api.bootup();
;
/* Fallback bootup routine for deferred speedy load */
setTimeout(function ()
if (!api.isRunning)
api.bootup();
, 1000);
api.bootup = function ()
api.isRunning = true;
// Place your normal app.init code here. Repeat the pattern in each of your components XA.component.Mycomponet namespace
;
CSS Deferral
Deferring your external CSS files and adding in an inline Critical CSS block also provides a great points boost. This can be automated using tools like Critical. This tool is good but not perfect. Using this across an SXA site will likely require some tweaking and trial and error to get it right. Once you have it working on one page it's a lot easier to roll out to others as many of the tweaks are the same.
SXA Layout
To hook in Critical CSS, JS and CSS Deferral into your solution you can extend the default SXA Layout. The provider of CSS and JS asset files is
Sitecore.XA.Foundation.Theming.Bundler.AssetLinksGenerator.cs
You can extend this class to gain access to each pages CSS and JS files, allowing you to structure the paths of the CSS and JS files into the structure required by the new layout and deferral code.
Lighthouse
Also, note that Google PageSpeed Insights is based on Lighthouse that is available in the Audit tab within chrome. The page speed tool was switched over to Lighthouse in mid-2018. The score achieved in the live version of the tool also filters through to Google Analytics reporting.
Code Samples
I have put together a functional SXA helix module with the tools and tips mentioned above. It's available here.
Many of the techniques used could be ported over to a more traditional Sitecore Helix build if needed.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "664"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f20947%2fhow-do-i-improve-my-sxa-sites-google-pagespeed-insights-score%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From numerous experiments, I have put together the following tips and tricks.
Note that a good score under the desktop tab is considerably easier to achieve, the mobile score in our responsive sites is the real score we should benchmark against.
Backend Vs Front End
Page speed can be divided into two distinct parts. Backend server response and front end structure.
To get close to that desired score you need to get both working well together. I found the following to have the biggest impact:
Backend:
- Sitecore HTML Cache / Rendering Cache (tuned)
- Adequately sized servers.
- Image optimisation processor (Dianoga still seems widely used).
- Throw in a CDN for your media library for good measure.
- With SXA turning on the optimizer is a must for production and will improve the google analytics score (to a point) but the component-based nature of an SXA build will still likely result in many CSS and JS files.
Front End:
- Responsive images
- Lazy loaded images
Critical CSS in combination with deferred stylesheets. (this comes with challenges, but can be achieved.)
Deferred Javascript (this also comes with challenges, but can be achieved.)
Javascript deferral
Large amounts of JS code, in particular, has a big impact on page speed score when it's not deferred. Javascript is parsed and compiled in the browser and this has a load time cost.
Deferring Javascript does require a good working knowledge of SXA and the javascript code in the components. To get maximum benefit I found that the javascript files had to be deferred for 5 - 10 seconds depending on the site. This was so that the Lighthouse audit does not consider them part of the main page load. During this time some interactions on the page are not available, as they only kick in when the javascript finishes loading. This is where a working knowledge of javascript comes in as you may need code in some vanilla javascript that provides a nice experience until the deferred load completes. For example: fading in a clickable drop downlink.
Ensuring Load Order
This page contains a script that will allow you to defer javascript while still guaranteeing the execution order of the SXA javascript files inserted. Given that some of the OOTB SXA modules appear to be based on Jquery this is fairly important as the JQuery object needs to be available before other files load.
SXA JS Bootup
Furthermore, because the page load completed event may have already triggered before a deferred SXA Javascript file is loaded your code may need to have a bootup fallback. I found the following pattern to work in both deferred and non-deferred scenarios.
api.isRunning = false;
api.init = function ()
api.bootup();
;
/* Fallback bootup routine for deferred speedy load */
setTimeout(function ()
if (!api.isRunning)
api.bootup();
, 1000);
api.bootup = function ()
api.isRunning = true;
// Place your normal app.init code here. Repeat the pattern in each of your components XA.component.Mycomponet namespace
;
CSS Deferral
Deferring your external CSS files and adding in an inline Critical CSS block also provides a great points boost. This can be automated using tools like Critical. This tool is good but not perfect. Using this across an SXA site will likely require some tweaking and trial and error to get it right. Once you have it working on one page it's a lot easier to roll out to others as many of the tweaks are the same.
SXA Layout
To hook in Critical CSS, JS and CSS Deferral into your solution you can extend the default SXA Layout. The provider of CSS and JS asset files is
Sitecore.XA.Foundation.Theming.Bundler.AssetLinksGenerator.cs
You can extend this class to gain access to each pages CSS and JS files, allowing you to structure the paths of the CSS and JS files into the structure required by the new layout and deferral code.
Lighthouse
Also, note that Google PageSpeed Insights is based on Lighthouse that is available in the Audit tab within chrome. The page speed tool was switched over to Lighthouse in mid-2018. The score achieved in the live version of the tool also filters through to Google Analytics reporting.
Code Samples
I have put together a functional SXA helix module with the tools and tips mentioned above. It's available here.
Many of the techniques used could be ported over to a more traditional Sitecore Helix build if needed.
add a comment |
From numerous experiments, I have put together the following tips and tricks.
Note that a good score under the desktop tab is considerably easier to achieve, the mobile score in our responsive sites is the real score we should benchmark against.
Backend Vs Front End
Page speed can be divided into two distinct parts. Backend server response and front end structure.
To get close to that desired score you need to get both working well together. I found the following to have the biggest impact:
Backend:
- Sitecore HTML Cache / Rendering Cache (tuned)
- Adequately sized servers.
- Image optimisation processor (Dianoga still seems widely used).
- Throw in a CDN for your media library for good measure.
- With SXA turning on the optimizer is a must for production and will improve the google analytics score (to a point) but the component-based nature of an SXA build will still likely result in many CSS and JS files.
Front End:
- Responsive images
- Lazy loaded images
Critical CSS in combination with deferred stylesheets. (this comes with challenges, but can be achieved.)
Deferred Javascript (this also comes with challenges, but can be achieved.)
Javascript deferral
Large amounts of JS code, in particular, has a big impact on page speed score when it's not deferred. Javascript is parsed and compiled in the browser and this has a load time cost.
Deferring Javascript does require a good working knowledge of SXA and the javascript code in the components. To get maximum benefit I found that the javascript files had to be deferred for 5 - 10 seconds depending on the site. This was so that the Lighthouse audit does not consider them part of the main page load. During this time some interactions on the page are not available, as they only kick in when the javascript finishes loading. This is where a working knowledge of javascript comes in as you may need code in some vanilla javascript that provides a nice experience until the deferred load completes. For example: fading in a clickable drop downlink.
Ensuring Load Order
This page contains a script that will allow you to defer javascript while still guaranteeing the execution order of the SXA javascript files inserted. Given that some of the OOTB SXA modules appear to be based on Jquery this is fairly important as the JQuery object needs to be available before other files load.
SXA JS Bootup
Furthermore, because the page load completed event may have already triggered before a deferred SXA Javascript file is loaded your code may need to have a bootup fallback. I found the following pattern to work in both deferred and non-deferred scenarios.
api.isRunning = false;
api.init = function ()
api.bootup();
;
/* Fallback bootup routine for deferred speedy load */
setTimeout(function ()
if (!api.isRunning)
api.bootup();
, 1000);
api.bootup = function ()
api.isRunning = true;
// Place your normal app.init code here. Repeat the pattern in each of your components XA.component.Mycomponet namespace
;
CSS Deferral
Deferring your external CSS files and adding in an inline Critical CSS block also provides a great points boost. This can be automated using tools like Critical. This tool is good but not perfect. Using this across an SXA site will likely require some tweaking and trial and error to get it right. Once you have it working on one page it's a lot easier to roll out to others as many of the tweaks are the same.
SXA Layout
To hook in Critical CSS, JS and CSS Deferral into your solution you can extend the default SXA Layout. The provider of CSS and JS asset files is
Sitecore.XA.Foundation.Theming.Bundler.AssetLinksGenerator.cs
You can extend this class to gain access to each pages CSS and JS files, allowing you to structure the paths of the CSS and JS files into the structure required by the new layout and deferral code.
Lighthouse
Also, note that Google PageSpeed Insights is based on Lighthouse that is available in the Audit tab within chrome. The page speed tool was switched over to Lighthouse in mid-2018. The score achieved in the live version of the tool also filters through to Google Analytics reporting.
Code Samples
I have put together a functional SXA helix module with the tools and tips mentioned above. It's available here.
Many of the techniques used could be ported over to a more traditional Sitecore Helix build if needed.
add a comment |
From numerous experiments, I have put together the following tips and tricks.
Note that a good score under the desktop tab is considerably easier to achieve, the mobile score in our responsive sites is the real score we should benchmark against.
Backend Vs Front End
Page speed can be divided into two distinct parts. Backend server response and front end structure.
To get close to that desired score you need to get both working well together. I found the following to have the biggest impact:
Backend:
- Sitecore HTML Cache / Rendering Cache (tuned)
- Adequately sized servers.
- Image optimisation processor (Dianoga still seems widely used).
- Throw in a CDN for your media library for good measure.
- With SXA turning on the optimizer is a must for production and will improve the google analytics score (to a point) but the component-based nature of an SXA build will still likely result in many CSS and JS files.
Front End:
- Responsive images
- Lazy loaded images
Critical CSS in combination with deferred stylesheets. (this comes with challenges, but can be achieved.)
Deferred Javascript (this also comes with challenges, but can be achieved.)
Javascript deferral
Large amounts of JS code, in particular, has a big impact on page speed score when it's not deferred. Javascript is parsed and compiled in the browser and this has a load time cost.
Deferring Javascript does require a good working knowledge of SXA and the javascript code in the components. To get maximum benefit I found that the javascript files had to be deferred for 5 - 10 seconds depending on the site. This was so that the Lighthouse audit does not consider them part of the main page load. During this time some interactions on the page are not available, as they only kick in when the javascript finishes loading. This is where a working knowledge of javascript comes in as you may need code in some vanilla javascript that provides a nice experience until the deferred load completes. For example: fading in a clickable drop downlink.
Ensuring Load Order
This page contains a script that will allow you to defer javascript while still guaranteeing the execution order of the SXA javascript files inserted. Given that some of the OOTB SXA modules appear to be based on Jquery this is fairly important as the JQuery object needs to be available before other files load.
SXA JS Bootup
Furthermore, because the page load completed event may have already triggered before a deferred SXA Javascript file is loaded your code may need to have a bootup fallback. I found the following pattern to work in both deferred and non-deferred scenarios.
api.isRunning = false;
api.init = function ()
api.bootup();
;
/* Fallback bootup routine for deferred speedy load */
setTimeout(function ()
if (!api.isRunning)
api.bootup();
, 1000);
api.bootup = function ()
api.isRunning = true;
// Place your normal app.init code here. Repeat the pattern in each of your components XA.component.Mycomponet namespace
;
CSS Deferral
Deferring your external CSS files and adding in an inline Critical CSS block also provides a great points boost. This can be automated using tools like Critical. This tool is good but not perfect. Using this across an SXA site will likely require some tweaking and trial and error to get it right. Once you have it working on one page it's a lot easier to roll out to others as many of the tweaks are the same.
SXA Layout
To hook in Critical CSS, JS and CSS Deferral into your solution you can extend the default SXA Layout. The provider of CSS and JS asset files is
Sitecore.XA.Foundation.Theming.Bundler.AssetLinksGenerator.cs
You can extend this class to gain access to each pages CSS and JS files, allowing you to structure the paths of the CSS and JS files into the structure required by the new layout and deferral code.
Lighthouse
Also, note that Google PageSpeed Insights is based on Lighthouse that is available in the Audit tab within chrome. The page speed tool was switched over to Lighthouse in mid-2018. The score achieved in the live version of the tool also filters through to Google Analytics reporting.
Code Samples
I have put together a functional SXA helix module with the tools and tips mentioned above. It's available here.
Many of the techniques used could be ported over to a more traditional Sitecore Helix build if needed.
From numerous experiments, I have put together the following tips and tricks.
Note that a good score under the desktop tab is considerably easier to achieve, the mobile score in our responsive sites is the real score we should benchmark against.
Backend Vs Front End
Page speed can be divided into two distinct parts. Backend server response and front end structure.
To get close to that desired score you need to get both working well together. I found the following to have the biggest impact:
Backend:
- Sitecore HTML Cache / Rendering Cache (tuned)
- Adequately sized servers.
- Image optimisation processor (Dianoga still seems widely used).
- Throw in a CDN for your media library for good measure.
- With SXA turning on the optimizer is a must for production and will improve the google analytics score (to a point) but the component-based nature of an SXA build will still likely result in many CSS and JS files.
Front End:
- Responsive images
- Lazy loaded images
Critical CSS in combination with deferred stylesheets. (this comes with challenges, but can be achieved.)
Deferred Javascript (this also comes with challenges, but can be achieved.)
Javascript deferral
Large amounts of JS code, in particular, has a big impact on page speed score when it's not deferred. Javascript is parsed and compiled in the browser and this has a load time cost.
Deferring Javascript does require a good working knowledge of SXA and the javascript code in the components. To get maximum benefit I found that the javascript files had to be deferred for 5 - 10 seconds depending on the site. This was so that the Lighthouse audit does not consider them part of the main page load. During this time some interactions on the page are not available, as they only kick in when the javascript finishes loading. This is where a working knowledge of javascript comes in as you may need code in some vanilla javascript that provides a nice experience until the deferred load completes. For example: fading in a clickable drop downlink.
Ensuring Load Order
This page contains a script that will allow you to defer javascript while still guaranteeing the execution order of the SXA javascript files inserted. Given that some of the OOTB SXA modules appear to be based on Jquery this is fairly important as the JQuery object needs to be available before other files load.
SXA JS Bootup
Furthermore, because the page load completed event may have already triggered before a deferred SXA Javascript file is loaded your code may need to have a bootup fallback. I found the following pattern to work in both deferred and non-deferred scenarios.
api.isRunning = false;
api.init = function ()
api.bootup();
;
/* Fallback bootup routine for deferred speedy load */
setTimeout(function ()
if (!api.isRunning)
api.bootup();
, 1000);
api.bootup = function ()
api.isRunning = true;
// Place your normal app.init code here. Repeat the pattern in each of your components XA.component.Mycomponet namespace
;
CSS Deferral
Deferring your external CSS files and adding in an inline Critical CSS block also provides a great points boost. This can be automated using tools like Critical. This tool is good but not perfect. Using this across an SXA site will likely require some tweaking and trial and error to get it right. Once you have it working on one page it's a lot easier to roll out to others as many of the tweaks are the same.
SXA Layout
To hook in Critical CSS, JS and CSS Deferral into your solution you can extend the default SXA Layout. The provider of CSS and JS asset files is
Sitecore.XA.Foundation.Theming.Bundler.AssetLinksGenerator.cs
You can extend this class to gain access to each pages CSS and JS files, allowing you to structure the paths of the CSS and JS files into the structure required by the new layout and deferral code.
Lighthouse
Also, note that Google PageSpeed Insights is based on Lighthouse that is available in the Audit tab within chrome. The page speed tool was switched over to Lighthouse in mid-2018. The score achieved in the live version of the tool also filters through to Google Analytics reporting.
Code Samples
I have put together a functional SXA helix module with the tools and tips mentioned above. It's available here.
Many of the techniques used could be ported over to a more traditional Sitecore Helix build if needed.
answered 9 hours ago
TomTTomT
6522 silver badges13 bronze badges
6522 silver badges13 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Sitecore Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f20947%2fhow-do-i-improve-my-sxa-sites-google-pagespeed-insights-score%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown