How to Set Up Collection Card Product Targeting
By default, product card targeting only works on collection pages. To enable product card targeting on search results, home pages, and custom pages, you need to add a small script to your product card templates.
Step 1: Locate Your Product Card Template
These are the cards that display each product in your collection.

Common locations for product card templates in Shopify themes:
snippets/card-product.liquidsnippets/product-card.liquidsnippets/product-grid-item.liquidsections/featured-product.liquid(for featured product sections)
How to find it
In your Shopify admin, go to Online Store → Themes
Click Actions → Edit code on your active theme
Look in the
snippets/orsections/folder for files with "product" or "card" in the name
Step 2: Add the Product Data Script and Update Variable Names
Copy and paste this script at the beginning of your product card template, right after the opening {%- if product -%} or {%- if card_product -%} line:
Update the variable names to match your template:
Important: The variable name must match what your template uses.
{{ product }}
Keep script as-is
{{ card_product }}
Replace all product with card_product
{{ featured_product }}
Replace all product with featured_product
{{ your_custom_variable }}
Replace all product with your_custom_variable
Example for card_product variable:
Step 3: Verify Installation
Navigate to a search results page or home page with product cards
Open your browser's developer console (press
F12orCmd+Option+I)Type:
console.log(window.igProductData)Press Enter
Expected result: You should see an object with product IDs as keys:
Last updated
Was this helpful?