Is using document.write to improve store speed a genuine fix or a fake?

Topic summary

A Shopify store owner discovered their hired “expert” used fraudulent code to artificially inflate PageSpeed scores without genuine performance improvements. The scam involves document.write with conditional logic that detects PageSpeed Insights/Lighthouse testing tools and serves them an empty page, resulting in falsely high scores (90-100) while actual users see the unchanged slow site.

Key Technical Details:

  • Code checks user agent for ‘Chrome-Lighthouse’ and similar testing identifiers
  • Returns minimal HTML to testing tools, full site to real visitors
  • Located in theme.liquid file, often wrapped in {%capture pDescription%} tags
  • Uses obfuscated hex strings to hide detection logic

Community Impact:

  • Multiple users report identical scams from Fiverr and Shopify Experts marketplace
  • “Web Nation Media” specifically named as perpetrator
  • Negative SEO consequences: Google may not properly index/rank affected stores
  • Some note “Shoptimized theme” uses similar tactics

Resolution:
Victims successfully removed malicious scripts by deleting the conditional code blocks and capture tags from theme.liquid. Discussion remains ongoing regarding legitimate speed optimization alternatives.

Summarized with AI on November 24. AI used: claude-sonnet-4-5-20250929.

I hired Shopify Expert to improve my store speed (it was at around 30 by shopify score and PageSpeed insight was bit better). At first it looked that he did an awesome job and mobile / comp by PageSpeed was approx 90-95 / 98-100. However, I was soon informed that the expert had been used document.write to bypass the Pagespeed score and there is not much real improvements in my sore speed, and that this is actually not good with SEO for example.

Question: is this true? did this “expert” do a fake fix?

Store is: www.pawsson.fi if anyone wanna check and give me an advise?

Thanks,

Pawsson

If you were told this is good for SEO, would you not mind that the developer used a hacky solution to increase your lab score?

But yes, if you see the screenshot bellow, and look at the pictures that PSI displays, you’ll see they look nothing like the actuall website, the developer put a conditional so that when the site is loaded by PSI, only an empty page is returned, which is why the score is high.

2 Likes

Thank you Oreoorbiz for confirming this. I checked a bit and it looks like that this guy have done same for other ppl too.

Not sure if it is inappropriate or not but I will publish the name, just in case it will prevent any other guy to fall into this trap! (moderator please delete this if you think this is not ok): So the scammer is Web Nation Media - https://experts.shopify.com/web-nation-media

DO NOT USE HIM! This guy should be thrown away from Shopify Experts.

Best,

Pawsson

2 Likes

same issue here, hired on Fiverr and got the same scam.

Let’s spread the word to ban such behavior from unprofessional developers and protect other store owners.

The code looks like this:

document.open();

if(window[‘\x6E\x61\x76\x69\x67\x61\x74\x6F\x72’][‘\x75\x73\x65\x72\x41\x67\x65\x6E\x74’].indexOf(‘\x43\x68\x72\x6F\x6D\x65\x2D\x4C\x69\x67\x68\x74\x68\x6F\x75\x73\x65’) == -1 && window[‘\x6E\x61\x76\x69\x67\x61\x74\x6F\x72’][‘\x75\x73\x65\x72\x41\x67\x65\x6E\x74’].indexOf(‘X11’) == -1 && window[‘\x6E\x61\x76\x69\x67\x61\x74\x6F\x72’][‘\x75\x73\x65\x72\x41\x67\x65\x6E\x74’].indexOf(‘\x47\x54\x6D\x65\x74\x72\x69\x78’) == -1) {

console.log(“normal user”);

document.write({{pDescription | json}});

}

else {

document.write(“

.

”);

}

document.close();

1 Like

i, any idea which is the part of the code to be removed to cancel this hack?

@nuova-idea ,

This script is illegal, that shows fake result.

you need to check in the theme.liquid file and remove this script as soon as possible that will affect your SEO. Google may not count your store rank.

Recently I have checked one store and caught this.

Just found similar script,

I’ve deleted it with the 3 elements together:

{%capture pDescription%} and {% capture vendors %} and their corresponding closing tags - {%endcapture%}.

-thank you guys from the chat: https://community.shopify.com/topic/1302210

Just for everyone to know - This is exactly what “shoptimized theme” uses and when you notice that it’s not working with google ads (as you’ll be suspended) and email them, they’ll ask you for access to your store and remove those lines

Hey Pawsson, wondering have your removed the malicious code yet, ran a store speed check and it still shows good results on google but the actual speed seems good, how did you go about that?

I got scammed by this exact same code.

Is there a way to genuinely bump up the Store Speed?