In recent weeks I've been on a crusade to improve PageSpeed and GTmetrix scores on one of my websites.
After many tweaks, some of which required learning new things, random pages from the site now score in the high nineties in both tools for desktop, and in the eighties for mobile in PageSpeed. I'm not fully satisfied yet but it's a significant improvement. Many pages would score 100 if I weren't running Adsense. That's a tradeoff I have to live with.
Some of the things I did:
Images. I used PageSpeed to hunt for images that needed compression. I used the compression tool at [kraken.io...] for many of them, and for some images which appear on many pages I paid a fellow on Fiverr to work on them. I don't know how he does it but he compresses them even better than Kraken. One affiliate banner which was over 80k when retrieved from Shareasale was 16k after he worked on it and I can see no difference in how it looks. On another front, I was able to replace some small images with emojis.
CSS. I added CSS into the <head> for styling items above the fold. That made PageSpeed stop complaining about CSS as a render-blocking resource. I still need to remove the corresponding lines from the main CSS file.
Fonts. I had been using a Google font, then started serving it locally. That made PageSpeed stop complaining about the font as a render-blocking resource. I don't provide every possible font variant, just those the site actually uses. At the site's present traffic levels the bandwidth cost of serving my own fonts is not a worry. I might rethink that if the site got busier.
DFP. I rebuilt my ads setup, and stopped using DoubleClick for Publishers. I had been using it to serve all my ads, both affiliate banners and Google Ads. I started serving the affiliate banners locally, and serve the Google Ads direct from AdSense instead of via DFP.
Analytics. I switched from Google Analytics to Matomo (formerly Piwik). That reduced PageSpeed's complaints about third-party code. There will also be privacy benefits.
Code clutter. I did everything I could think of to make my code leaner. I've learned to make better use of conditional statements so that certain code snippets no longer appear sitewide, but only on the pages where they're actually needed. Example: CSS in the <head>.
Validation. I obsessed about cleaning up validation errors, especially for template items which would appear on many pages. I don't know if that's a really a speed issue but I read someplace that browsers might take longer to render invalid code and it seemed plausible to me. Won't hurt, might help.
URL shortening.I started using YOURLS to create my own redirects / URL shorteners. Many long, ugly affiliate links have been replaced by shorter, prettier redirects. That reduces code clutter, and might improve signals of relevance.
Open graph info. I added social meta / open graph info to create optimized posts if someone shares one of my pages on social media. That adds code, but the savings from other things I did would pay for it.
Any more suggestions about measures to make pages faster?