# Shopify Competitor Price & Product Scraper (`restful_enoki/shopify-competitor-spy`) Actor

Extract Shopify store & collection products, SKUs, variant prices, discounts, and stock inventory in seconds without a browser. Automatically track competitor price drops, restocks & new launches with built-in diffing, 3-tier anti-block fallback, CSV/JSON export & AI MCP mode.

- **URL**: https://apify.com/restful_enoki/shopify-competitor-spy.md
- **Developed by:** [Null Pointer Ninja](https://apify.com/restful_enoki) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 products scraped

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Shopify Competitor Catalog & Price Spy (with Price-Drop Alerts & MCP Mode)

Extract complete product catalogs, variant pricing, sale discounts, real-time stock ratios, launch dates, and automated **price-drop / restock diffs** from any Shopify storefront — **no browser overhead, zero-config default run, and native AI Agent / MCP Compact Mode**.

***

### Why This Shopify Scraper Outperforms Basic Extractors

Most Shopify scrapers break immediately if a merchant blocks `/products.json`. This Actor uses a **3-Tier Extraction Fallback Chain** over lightweight TLS-spoofed HTTP (`got-scraping`):

1. **Tier 1 (`tier1_products_json`):** Fast paginated extraction from `/products.json?limit=250` (or `/collections/{handle}/products.json`).
2. **Tier 2 (`tier2_sitemap_ajax`):** Automatic failover to `/sitemap.xml` -> `/sitemap_products_1.xml` -> `/products/{handle}.js` (automatically converts Shopify integer cents into exact decimal prices).
3. **Tier 3 (`tier3_html_jsonld`):** Final HTML `application/ld+json` `Product` / `Offer` parser when JSON endpoints are restricted.

#### Built-In Competitive Intelligence

- **Discount & Sale Detection:** Auto-computes `compareAtPrice`, `isOnSale`, and exact `discountPct`.
- **Inventory Scarcity Ratio:** Tracks `inStock`, `availableVariantsCount`, `totalVariantsCount`, and `stockRatio` (e.g., `"3/8"`).
- **New-Launch Radar:** Computes `daysSinceLaunch` from `publishedAt` to spot trending dropshipping winners fast.
- **Automated Diff Tracking (Apify KV Store):** Detects `NEW_PRODUCT`, `PRICE_DROP`, `PRICE_INCREASE`, `RESTOCKED`, and `OUT_OF_STOCK` across scheduled runs.
- **AI Agent / MCP Compact Mode (`outputMode: "mcp_compact"`):** Emits `<400-byte` token-trimmed JSON payloads ideal for Claude, Cursor, LangGraph, and `n8n` AI workflows.

***

### Pay-Per-Event Pricing

- **`actor-start`**: `$0.02` per run
- **`product-scraped`**: `$0.002` per product (`$2.00` per 1,000 products)

Set a **Max cost per run** cap in Apify Console — the Actor automatically stops cleanly and saves all collected data when your cap is reached.

***

### Example Input JSON

#### Full Competitor Spy (Default / `n8n` / Excel Export)

```json
{
  "storeUrls": [
    "https://www.allbirds.com",
    "https://colourpop.com/collections/best-sellers"
  ],
  "maxProductsPerStore": 100,
  "minDiscountPct": 10,
  "inStockOnly": true,
  "enableChangeTracking": true,
  "outputMode": "full"
}
```

#### AI Agent / MCP Compact Mode

```json
{
  "storeUrls": ["https://www.allbirds.com"],
  "maxProductsPerStore": 25,
  "keyword": "runner",
  "outputMode": "mcp_compact"
}
```

***

### Example Output Item (`full`)

```json
{
  "storeDomain": "allbirds.com",
  "productId": "789456123",
  "handle": "mens-wool-runners",
  "title": "Men's Wool Runners",
  "vendor": "Allbirds",
  "productType": "Shoes",
  "priceMin": 98,
  "priceMax": 110,
  "compareAtPrice": 110,
  "isOnSale": true,
  "discountPct": 11,
  "currency": "USD",
  "inStock": true,
  "stockRatio": "6/8",
  "daysSinceLaunch": 42,
  "changeType": "PRICE_DROP",
  "previousPriceMin": 110,
  "strategyUsed": "tier1_products_json",
  "url": "https://www.allbirds.com/products/mens-wool-runners"
}
```

# Actor input Schema

## `storeUrls` (type: `array`):

One or more Shopify store domains, full URLs, or /collections/... URLs to spy on.

## `maxProductsPerStore` (type: `integer`):

Maximum number of products to extract per store URL (0 = unlimited up to 10,000).

## `minDiscountPct` (type: `integer`):

Only output products discounted by at least this percentage (0 = include all products).

## `inStockOnly` (type: `boolean`):

Skip products where all variants are sold out.

## `keyword` (type: `string`):

Optional case-insensitive filter matched against product title, tags, or product type.

## `vendor` (type: `string`):

Optional case-insensitive filter matched against product vendor/brand.

## `enableChangeTracking` (type: `boolean`):

Persist compact product snapshots in Apify Key-Value Store to detect NEW_PRODUCT, PRICE_DROP, and RESTOCKED events across scheduled runs.

## `outputMode` (type: `string`):

Use 'full' for complete spreadsheet/n8n export or 'mcp_compact' for <400-byte LLM/MCP agent payloads.

## `useApifyProxy` (type: `boolean`):

Enable Apify Proxy (recommended if a store enforces strict IP rate-limiting or geo-blocking).

## Actor input object example

```json
{
  "storeUrls": [
    "https://www.allbirds.com"
  ],
  "maxProductsPerStore": 15,
  "minDiscountPct": 0,
  "inStockOnly": false,
  "keyword": "",
  "vendor": "",
  "enableChangeTracking": true,
  "outputMode": "full",
  "useApifyProxy": false
}
```

# Actor output Schema

## `products` (type: `string`):

Dataset containing all extracted and diff-analyzed Shopify products.

## `runSummary` (type: `string`):

Summary statistics and any graceful warnings for the run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "storeUrls": [
        "https://www.allbirds.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("restful_enoki/shopify-competitor-spy").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "storeUrls": ["https://www.allbirds.com"] }

# Run the Actor and wait for it to finish
run = client.actor("restful_enoki/shopify-competitor-spy").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "storeUrls": [
    "https://www.allbirds.com"
  ]
}' |
apify call restful_enoki/shopify-competitor-spy --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,restful_enoki/shopify-competitor-spy"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/5T9iMoMZj5wZNjQ8C/builds/yBQxxUDbehrqkeclp/openapi.json
