Performance Cloudflare GTM Lighthouse

From 69 to 87 in Lighthouse: Cloudflare CDN, GTM and WebP in a single day.

How we raised the mobile performance score of molt.agency by setting up analytics with GDPR consent, optimized images and a CDN that solved the real bottleneck. Real metrics, mistakes included.

m.
molt.agency Aug 18, 2026 · 8 min read
Results · Emulated Moto G Power · Slow 4G · Lighthouse 13.4
Score mobile 87 before: 69 (+18 pts)
FCP 1.2 s before: 3.8 s (−2.6 s)
LCP 3.9 s before: 5.5 s (−1.6 s)
TBT 30 ms before: 142 ms (−112 ms)
CLS 0 before: 0.25 (stable)

01 The starting point: fast on desktop, slow on mobile.

molt.agency started the day with a Lighthouse score of 69 on mobile. The numbers said there was room: FCP at 3.8 s, LCP at 5.5 s and a TBT of 142 ms. The desktop score, on the other hand, was above 90. The gap was real and known.

Lighthouse's initial diagnosis pointed to three main culprits:

  • The 56 KiB CSS blocked rendering for 1.200 ms because the DigitalOcean server has a slow TTFB without edge caching.
  • A script gtag.js loaded directly caused 142 ms of forced reflow blocking the main thread.
  • The hero image was a PNG (102 KiB) instead of an optimized WebP with adaptive sizes.

Besides performance, we were missing analytics with GDPR consent and campaign conversion tracking. We decided to tackle it all in a single day of engineering.

04 Step 3: Hero images in WebP with responsive srcset.

The hero image of the decorative vector was an uncompressed original PNG. We converted to WebP and generated three sizes for the srcset:

Archive PNG original Optimized WebP
vector-01-640 51 KiB 18 KiB (−65 %)
vector-01-960 102 KiB 37 KiB (−64 %)
vector-01 (1920) 245 KiB 88 KiB (−64 %)

Lighthouse kept identifying that image as the LCP element because it falls inside the initial viewport on mobile (Moto G Power). With loading="lazy" it is excluded from LCP on viewports where it isn't visible, but in this case the image is large enough to appear above the fold.

05 Step 4: Cloudflare CDN — the change that moved the needle.

The real bottleneck was the DigitalOcean server: without edge caching, the 56 KiB CSS took 1.200 ms to reach the browser. No code trick was going to solve it. The definitive solution was to put a content delivery network in front.

We chose Cloudflare on the free plan. With the CDN active, the CSS goes from 1,200 ms to ~200–300 ms served directly from the Madrid data center. The impact on First Contentful Paint and Largest Contentful Paint is immediate.

Configuration enabled on Cloudflare Free
HTTP/2 + HTTP/3 (QUIC)
HTTP/2 to Origin
TLS 1.3 with end-to-end encryption
Speed Brain (smart prefetching)
Cloudflare Fonts
Early Hints (103)
0-RTT Connection Resumption
Browser Cache TTL: 1 year for static assets
Caching Level: Standard
Crawler Hints
Always use HTTPS with HSTS
Automatic Brotli compression at the edge
Rocket Loader: leave it disabled (OFF). Although it improves paint on JS-heavy pages, it can delay or break the initialization of Google Consent Mode because it delays running the snippet that must execute synchronously before everything else.

06 Step 5: DNS migration from DigitalOcean to Cloudflare with no service interruptions.

The domain was registered at OVH with the nameservers pointing to DigitalOcean. For Cloudflare to be the authoritative DNS, the NS records were changed in the registrar's panel:

Layer Before After
Registrar OVH (unchanged) OVH (unchanged)
Nameservers ns1/2/3.digitalocean.com benedict / josephine.ns.cloudflare.com
DNS Zone DigitalOcean Cloudflare (proxy on)
Origin server 137.184.199.231 137.184.199.231 (unchanged)

Cloudflare imported the DNS records automatically, but the records for Resend y AWS SES were missing because they were configured in DigitalOcean, not in the original OVH zone. We added them manually before propagation finished to avoid transactional email outages.

Note on ERR_QUIC_PROTOCOL_ERROR: during propagation, some browsers had the Alt-Svc QUIC header of the previous server cached (LiteSpeed on DigitalOcean). When the server changes, the QUIC keys don't match and the connection can occasionally fail. The solution is to pause HTTP/3 temporarily during propagation and re-enable it once the CDN is the only global entry point.

07 Results: from 69 to 87 in a single day.

The score from Cloudflare's Observatory (which always goes through the CDN) reflects the real ceiling reached. All Core Web Vitals turned green on the reference emulated mobile profile:

Lighthouse score
87
+18 points 69
FCP
1.2 s
−2.6 s 3.8 s
LCP
3.9 s
−1.6 s 5.5 s
TBT
30 ms
−112 ms 142 ms
CLS
0
−0.25 0.25
Speed Index
2.2 s
−2.7 s 4.9 s

08 What's left to reach 90+.

The only remaining obstacle is the 56 KiB CSS that is still render-blocking. We tried making it async with the usual trick of onload, but the Speed Index rose from 2.9 s to 4.9 s because of FOUC (Flash of Unstyled Content): Tailwind CSS generates positional classes that affect the visible layout before the full file loads.

The clean solution is inline Critical CSS: extract the above-the-fold CSS, inline it in the <head> and load the full CSS asynchronously. With Tailwind 4 and Vite this fits into the build pipeline.

Pending for the 90+ barrier
  • Inline Critical CSS with Critters integrated into the Vite build.
  • Cloudflare cache rules for /dist/* with an explicit edge TTL of 1 year.
  • Verification of real conversions in Google Ads with advanced attribution.
  • Confirmation of events in GA4 Realtime.
“Speed isn't a cosmetic patch added at the end: it's delivery architecture. A well-configured CDN solves more bottlenecks than weeks of JavaScript micro-optimizations.”

Keep reading

All articles →
Does your website have the same problem?

Performance and CDN, no technical jargon.

We diagnose it, tell you the order of priority and, if you want, we implement it ourselves in 48 hours.