How to Remove Product Recommendation Parameters in Shopify (And Fix Google Search Console Issue)

|

Michal Sieroslawski

One of the early challenges many Shopify store owners encounter is a rapid surge of non-indexed pages in Google Search Console, specifically in the “Alternate page with proper canonical tag” section. These URLs, often containing strings like “/?pr_prod_strat=”, “pr_seq=uniform,” or “?pr_prod_strat=pinned&pr_rec_id=”, might seem harmless, but they can confuse search engines and potentially harm your SEO efforts. The message “Alternate page with proper canonical tag” in GSC means Google recognizes these pages as alternate versions of other pages on your site. The canonical tag is a way to signal to Google which page is the preferred version to index and serve in search results.

Why should this concern you? Google has limited resources to crawl your website. If you have numerous alternate pages (which accumulate quickly if “recommended products” sections exist on products, collections, and blog articles) that are essentially duplicates or very similar to your main product pages, it can waste valuable crawl budget that could be better spent on indexing your more important content.

Here are the nine steps to resolve this “Alternate page with proper canonical tag” issue.

  1. Identify the Source
  2. Understand the Code
  3. Backup Your Theme
  4. Modify URL Generation
  5. Save and Preview
  6. Test Clicks
  7. Submit Removal Requests
  8. Monitor GSC
  9. Update Sitemap (Optional)

1. Identify the Problem

The first step in resolving unwanted product recommendation URLs is confirming that you’re facing the same issue. In Google Search Console (GSC), check the “Alternate page with proper canonical tag” section for a list of URLs containing strings like “/?pr_prod_strat=”, “pr_seq=uniform,” or “?pr_prod_strat=pinned&pr_rec_id=”.

These URLs are often duplicates or “alternate” versions of your product pages, created by the recommended product sections on your website. If your eCommerce store features “featured products” or “you may also like” sections on product, collection, or blog pages, each product in those sections will generate a new, duplicate URL in addition to its original, or “canonical,” product page.

(See image below)

google search console issue

If that’s the case, there’s a simple way to fix this in your Shopify theme editor. Head to your Shopify admin dashboard, navigate to “Online Store” > “Themes,” click on the ellipsis (three dots) next to your active theme, and then hit the “Edit code” button.

2. Understand the Code

Why do these long URLs appear on each product recommendation card? It’s how Shopify’s recommendation module learns and optimizes product suggestions based on customer behavior, clicks, impressions, and more. This data provides valuable insights within your Shopify dashboard, helping you determine which products to recommend based on various criteria. However, while beneficial for sales, these URLs are detrimental to SEO. They can confuse search engines and consume valuable crawl budget by generating numerous pages that are essentially duplicate content.

Let’s break down each part of the URL to understand its meaning and how to address this issue.

Base URL

  • https://yourwebsite.com/products/leather-jacket: This is the main part of the address, directing you to the specific product page for ‘leather jacket’ on ‘your website’.

Query Parameters

Everything after the question mark (?) is a set of query parameters. These are essentially little bits of extra information that the website can use to track how you got to this page and personalize your experience. Here’s the breakdown of each parameter:

  • pr_prod_strat=pinned: This suggests that the product you’re viewing is being featured prominently (pinned) on the website, usually as part of a promotion or curated list.
  • pr_rec_id=070eab756: This is a unique identifier for a specific product recommendation. It helps the website understand which suggestions are leading to sales.
  • pr_rec_pid=8994824585543: This is a unique ID for the product that was recommended to you, likely the leather jacket itself in this case.
  • pr_ref_pid=8994767798599: This is another product ID, possibly indicating a different item that you viewed before this one. It helps the website analyze your browsing behavior and tailor recommendations.
  • pr_seq=uniform: This might indicate that the product recommendations are being displayed in a random or evenly distributed way, rather than being based on a specific order or algorithm.

Essentially, these query parameters are a way for the website to collect data on how people are finding and interacting with their products. This information can be used to:

  • Measure the effectiveness of marketing campaigns: By analyzing which recommendations are driving the most sales, the company can identify the most successful strategies.
  • Personalize product recommendations: The more they know about your browsing history, the better they can suggest other items you might like.
  • Optimize the shopping experience: By understanding how people navigate their site, they can improve the design and make it easier to find what you’re looking for.

3. Backup Your Theme

Creating a backup of your current theme before making any code changes is a wise precaution, especially if you’re new to Shopify theme editing. While not strictly essential, having a backup ensures you can easily revert to the original version if you encounter any unexpected issues or errors during the modification process.pen_sparktunesharemore_vert

4. Modify URL Generation

To modify how a product URL is generated on your website, the first step is locating the right file. The exact place where you will need to make changes will depend form your Shopify theme. Here are a few options for locating the file with the code responsible for generating the unwanted URLs:

  1. card-product.liquid: This snippet is specifically mentioned as a potential location for the code generating the URLs.
  2. Similar snippets: Look for files with names like product-item, featured-product, or other snippets related to displaying product information or recommendations.
  3. Liquid files mentioned in the thread:
    • collection-grid-item.liquid
    • product-recommendations.liquid
    • product-template.liquid

This file typically contains the line {{ card_product.url }}, as shown in this image.

product card code location
{{ card_product.url }}

The original code {{ card_product.url }} is a simple way to generate the full web address (URL) for a specific product on your website. This includes:

  • The Base URL: This is the core address of the product page (e.g., https://yourwebsite.com/products/leather-jacket)
  • Query Parameters: The extra bits of information we discussed earlier, often used for tracking and personalization.

To remove these extra bits of information from the URL, you can modify the code to {{ card_product.url | default: "#" | split: "?" | first }}.

The new code {{ card_product.url | default: "#" | split: "?" | first }} does the following:

  1. default: "#": This ensures that if there’s no product URL available (maybe the product is missing or there’s an error), the link will default to “#”, which often means a link to the top of the current page.
  2. split: "?": This divides the URL into two parts whenever it finds a question mark (?). The question mark is the character that separates the base URL from the query parameters.
  3. first: This selects only the first part of the split URL, which is the base URL without any query parameters.

The Result:

The modified code essentially gives you a “cleaner” version of the product URL. Instead of this:

https://yourwebsite.com/products/leather-jacket?pr_prod_strat=pinned&pr_rec_id=070eab756...

You’ll get just this:

https://yourwebsite.com/products/leather-jacket

This new code splits the URL at the question mark (the separator between the base URL and parameters) and then selects only the first part, resulting in a cleaner link without the parameters.

5. Save and Preview

Once you’ve saved your changes, open a new tab and navigate to your product pages. Scroll to the “Featured Products” section, and verify that the URL in the bottom-left corner points to the canonical product page, not the long URL with tracking parameters. If everything looks correct, your related products are displayed without extra parameters.

Important: Remember that Shopify theme updates can overwrite custom code changes. If this happens, you’ll need to repeat the process. The dot next to “card-product.liquid” (or the relevant file name) indicates you’ve modified the code, so you can easily locate it in the future.

6. Test Clicks

After verifying the visual accuracy of the URLs, click on each recommended product to ensure they lead to the intended product page. This final step confirms that the links function correctly and that clicking them doesn’t generate any unexpected or unwanted URLs with tracking parameters.

7. Submit Removal Requests in Google Search Console

In Google Search Console (GSC), request removal of the old URLs using the URL Inspection tool or the “Remove all URLs with this prefix” feature. (Use the prefix “/?pr_prod_strat=” for a broader approach or specify the full URL prefix for your site.)

8. Monitor GSC

Regularly check the “Index Coverage” and “Removals” reports in GSC to track the removal progress and verify that the unwanted URLs are gone.

9. Update Sitemap (Optional)

Submit an updated XML sitemap to GSC to ensure Google focuses on indexing your desired pages.

Good Luck!

Leave a Comment