Cover: hidden spam links in Shopify themes

Hidden spam links in Shopify themes: how to find and remove them

Hidden spam links are links to casino, pharmacy, loan or adult sites that are placed in your store’s pages but kept out of sight. Your customers do not see them. Search engines and ad review systems do.

Most store owners learn about them in an unpleasant way: rankings drop, Google Search Console shows a security issue, or a Google Ads account is suspended. This guide explains where these links come from and how to find them.

Why hidden links matter

  • Search rankings. Google’s spam policies treat link spam and hacked content as violations. A store with injected spam links can lose rankings or show a warning in search results.
  • Advertising. Ad platforms review the pages you send traffic to. In one case reported in the Shopify Community, Google Ads rejected a store’s account because of spam links that nobody in the team could see on the page.
  • Trust. If a customer or a partner finds the links in your source code, it looks like the store is not looked after.

How the links get in

  1. Theme files. Someone with access to the theme, or a compromised account, adds a block of links to a layout file or a snippet.
  2. Apps. Many apps add their own scripts to every page. A script from an app can insert links into the page in the visitor’s browser. In one case discussed in the Shopify Community in 2025, the spam came through app code loaded on every page, not from the theme.
  3. Content. Product descriptions, pages and blog posts can contain hidden HTML, especially if content was copied from other sites or imported in bulk.
  4. Old code. An app you removed long ago can leave snippets in the theme. If the app’s domain later changes hands, its old code can start serving something else.

How the links are hidden

Typical tricks:

  • the block is hidden with CSS, for example display: none, a position far outside the screen, a font size of zero or text in the same color as the background;
  • the links are shown only to search engine robots and not to normal visitors;
  • the links are added by JavaScript after the page loads, so they do not appear in the theme files.

Because of these tricks, looking at your store in a browser is not enough.

Step 1. Ask Google what it sees

  1. Search Google for site:yourstore.com together with words like casino, viagra, loan or porn. Any result from your own domain with such words needs a closer look.
  2. In Google Search Console, open Security issues and Manual actions. Both should say that no issues were detected.
  3. In Search Console, use URL Inspection on your home page and a product page, test the live URL and view the tested page HTML. This is the code Google received. Search it for links to sites you do not know.

Step 2. Check the page source

  1. Open your home page, choose View page source and search (Ctrl+F or Cmd+F) for href= .
  2. Look for links to domains that have nothing to do with your store, especially groups of links close together.
  3. Repeat on a product page, a collection page and a blog post.

If the links are added by JavaScript, they will not appear in View page source. In that case open the browser developer tools (F12), go to the Elements tab and search there: it shows the page after scripts have run.

Step 3. Check your theme files

Go to Online Store, open the … menu of your live theme and choose Edit code. Search the files theme.liquid, header and footer sections and snippets for:

  • blocks of links with display: none or similar hiding styles;
  • links to unknown domains;
  • script tags loading files from domains you do not recognise.

The code editor keeps earlier versions of theme files in its Timeline view (files in the assets folder have no Timeline), so you can see when a block appeared and compare it with the previous version.

Step 4. Check content in bulk

  • Products: go to Products, choose Export, and search the exported CSV file for http links and for words like casino or pharmacy.
  • Pages and blog posts: open the ones that get the most traffic and switch the editor to HTML view to see the code behind the text.

Step 5. Check apps

If the links are not in the theme or the content, they are probably added by an app. Remove apps you do not use, then repeat step 2. If the links disappear after you disable a particular app, contact its developer and Shopify Support.

How to remove them and recover

  1. Duplicate the theme before you change anything, so you can go back.
  2. Remove the links from the theme, the content or by removing the app.
  3. Change passwords of staff accounts, remove old staff and collaborator accounts and turn on two-step authentication for everyone.
  4. If Google showed a security issue or a manual action, request a review in Search Console after the cleanup.
  5. If your Google Ads account was affected, appeal after the links are gone and the pages are clean.

Free tools

Our free online tools can help with a first check from the outside:

Check every week, not once

Hidden links come back when the cause is not found: a compromised account, an app or an old snippet. SiteGuarding Store Scanner checks your storefront pages the way a visitor’s browser does, after scripts have run, and reports hidden links, spam text, injected scripts and theme files that changed between scans. It only reads and never edits your store. The Free plan includes a scan every 7 days and shows every critical and high finding in full.

Install SiteGuarding Store Scanner from the Shopify App Store: https://apps.shopify.com/siteguarding-store-scanner