# Shopee & Lazada Price & Stock Tracker (Vietnam) (`ngockaka/shopee-lazada-price-tracker`) Actor

Track price and stock of Shopee.vn and Lazada.vn products over time. Paste product URLs, get current price, discount, stock status and sold count, plus price-change alerts vs the previous run. Built for Vietnamese sellers monitoring their own and competitors' listings.

- **URL**: https://apify.com/ngockaka/shopee-lazada-price-tracker.md
- **Developed by:** [Ngoc KaKa](https://apify.com/ngockaka) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 product checkeds

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/running/actors-in-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

## Shopee & Lazada Price & Stock Tracker (Vietnam)

Track the price and stock of products on **Shopee.vn** and **Lazada.vn** over time.
Paste product URLs, get the current price, discount, stock status and sold count —
plus an alert whenever the price moves or a product goes out of stock.

Built for Vietnamese sellers who want to monitor their own listings and their
competitors' prices without opening every product page by hand.

### What it does

For every product URL you give it, the Actor returns one dataset row:

| Field | Meaning |
|---|---|
| `platform` | `shopee` or `lazada` |
| `title`, `shop`, `brand` | Product and seller info |
| `price`, `originalPrice`, `discountPct` | Current price in VND, pre-discount price, discount % |
| `inStock`, `stock` | Stock status (Shopee also returns the stock count) |
| `sold`, `rating`, `ratingCount` | Sold count and ratings (Shopee API only — not yet verified live, see below) |
| `previousPrice`, `priceChange`, `priceChangePct` | Change versus the previous run |
| `priceAlert`, `stockAlert`, `alertReason` | Alerts when the price moved past your threshold or stock flipped |
| `checkedAt`, `status`, `error` | When it was checked, and what happened |

**Price history is persistent.** Each run saves its results in the Actor
key-value store (`price-history`, last 30 checks per product), so the next run
can compare and flag changes. Run it on a schedule (e.g. every morning) and you
get a day-by-day price history for every product you watch.

### Input

| Field | Default | Meaning |
|---|---|---|
| `productUrls` | — (required) | Shopee.vn / Lazada.vn product URLs, max 100 per run |
| `alertThresholdPct` | `5` | Flag `priceAlert` when the price changed by at least this % |
| `saveHistory` | `true` | Keep price history for later runs |
| `requestDelayMs` | `2000` | Pause between requests (~30 req/min) |
| `shopeeCookie` | — | Optional session cookie, only if Shopee items come back `blocked` |
| `lazadaCookie` | — | Optional session cookie, only if Lazada items come back `blocked` |
| `useProxy` | `false` | Route through the Apify residential proxy (extra platform usage) |

URL formats:

- Shopee: `https://shopee.vn/<name>-i.<shopId>.<itemId>`
- Lazada: `https://www.lazada.vn/products/<name>-i<itemId>-s<skuId>.html`

### Honest limits

- **Shopee blocks datacenter IPs.** Its product API returns HTTP 403 without a
  valid session cookie. If Shopee items come back `blocked`, paste your browser
  session cookie into `shopeeCookie` (Chrome DevTools → Application → Cookies →
  `shopee.vn`, copy the full `Cookie` header value) or turn on `useProxy`.
  The Actor never fakes data: blocked items are reported as `blocked`.
  Shopee fields (`originalPrice`, `stock`, `sold`, `rating`) come from the
  Shopee item API and are **not yet verified against a live response** —
  every live test so far hit the 403 block. They will be verified on the
  platform run with a cookie or proxy.
- **Lazada sold count and rating are not in the static page**, so those fields
  are `null` for Lazada items. Price, title, brand and stock status are
  extracted from the page.
- The Actor is polite by design: sequential requests, ~2 s apart, max 100
  products per run.
- **HTTP/1.1 only.** The Actor uses a custom HTTP client that forces HTTP/1.1
  (`got-scraping` with `http2: false`). The default HTTP/2 path breaks behind
  egress/transparent proxies ("Requested origin … does not match server
  …:3128"); HTTP/1.1 works in those environments and on the Apify platform.

### Tested locally (2026-11-10)

`apify run` with 3 real product URLs, ~47 s total, max 30 req/min:

| Product | Result |
|---|---|
| Lazada XIAOYOU bone-conduction headphones (3263617202) | ✅ `ok` — price 1,243,000₫, title, brand XIAOYOU, InStock |
| Lazada men's sportswear set VNO100 (2210811094) | ✅ `ok` — price 150,000₫, title, InStock |
| Shopee discount link (shop 57737923, item 4938305683) | 🚫 `blocked` — HTTP 403 (error 90309999), datacenter IP blocked as expected |

Price-history/alert path verified in a single-process run with seeded history:
XIAOYOU 1,400,000₫ → 1,243,000₫ = **−11.21% → `priceAlert: true`**,
VNO100 unchanged 150,000₫ → no alert. Final tally: ok=2, blocked=1, alerts=1.

One Lazada test URL (CHAOMILI, 3197539687) turned out to be a removed product
(HTTP 404, "Sản phẩm này không còn tồn tại") — the Actor now reports that
explicitly instead of a generic parse error.

Local-testing notes: run with the egress proxy env vars unset
(`env -u https_proxy -u HTTPS_PROXY -u http_proxy -u HTTP_PROXY apify run`),
because `got-scraping`'s proxy agent hangs against this VM's egress proxy.
Also note the local memory-storage layer (Apify SDK 3.7.2) does not carry
key-value-store values across processes — each local run starts with empty
price history (and `apify run` purges local stores first). On the Apify
platform the cloud key-value store persists across runs, so scheduled runs
compare against real history.

### Pricing

**Pay per event: $0.005 per product successfully checked.** Platform usage is
included in that price. You only pay for products that returned data.

### Use cases

- Watch your own Shopee/Lazada listings and get alerted when a competitor
  undercuts you.
- Track a product you want to buy and catch the next price drop.
- Build a price history table for a whole category before a sale event
  (11.11, 12.12, Tết).

# Actor input Schema

## `alertThresholdPct` (type: `number`):

Flag priceAlert when the price changed by at least this percent versus the previous run.

## `lazadaCookie` (type: `string`):

Only needed if Lazada items come back 'blocked' (anti-bot challenge). Paste your browser session cookie for lazada.vn the same way as the Shopee cookie.

## `productUrls` (type: `array`):

Shopee.vn and Lazada.vn product URLs to check (max 100 per run). Shopee: https://shopee.vn/<name>-i.<shopId>.<itemId>. Lazada: https://www.lazada.vn/products/<name>-i<itemId>-s<skuId>.html

## `requestDelayMs` (type: `integer`):

Pause between requests to avoid hammering the marketplaces. 2000 ms = ~30 requests/minute.

## `saveHistory` (type: `boolean`):

Store each check in the Actor key-value store (record 'price-history', last 30 checks per product) so later runs can compare prices and detect changes.

## `shopeeCookie` (type: `string`):

Shopee blocks datacenter IPs. If Shopee items come back 'blocked', paste your browser session cookie here (from Chrome DevTools > Application > Cookies > shopee.vn, copy the full 'Cookie' header value). The cookie is used only for this run and never stored in the output.

## `useProxy` (type: `boolean`):

Route requests through the Apify residential proxy (extra platform usage cost). Recommended for Shopee when no session cookie is available.

## Actor input object example

```json
{
  "alertThresholdPct": 5,
  "lazadaCookie": "",
  "productUrls": [
    "https://shopee.vn/lien-ket-giam-gia-i.57737923.4938305683",
    "https://www.lazada.vn/products/tai-nghe-bluetooth-khong-day-i3263617202-s0.html",
    "https://www.lazada.vn/products/-i3197539687-s0.html"
  ],
  "requestDelayMs": 2000,
  "saveHistory": true,
  "shopeeCookie": "",
  "useProxy": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "lazadaCookie": "",
    "productUrls": [
        "https://shopee.vn/lien-ket-giam-gia-i.57737923.4938305683",
        "https://www.lazada.vn/products/tai-nghe-bluetooth-khong-day-i3263617202-s0.html",
        "https://www.lazada.vn/products/-i3197539687-s0.html"
    ],
    "shopeeCookie": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("ngockaka/shopee-lazada-price-tracker").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 = {
    "lazadaCookie": "",
    "productUrls": [
        "https://shopee.vn/lien-ket-giam-gia-i.57737923.4938305683",
        "https://www.lazada.vn/products/tai-nghe-bluetooth-khong-day-i3263617202-s0.html",
        "https://www.lazada.vn/products/-i3197539687-s0.html",
    ],
    "shopeeCookie": "",
}

# Run the Actor and wait for it to finish
run = client.actor("ngockaka/shopee-lazada-price-tracker").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 '{
  "lazadaCookie": "",
  "productUrls": [
    "https://shopee.vn/lien-ket-giam-gia-i.57737923.4938305683",
    "https://www.lazada.vn/products/tai-nghe-bluetooth-khong-day-i3263617202-s0.html",
    "https://www.lazada.vn/products/-i3197539687-s0.html"
  ],
  "shopeeCookie": ""
}' |
apify call ngockaka/shopee-lazada-price-tracker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ngockaka/shopee-lazada-price-tracker"
        }
    }
}
```

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/FoV3nhfNNA2OGkO1n/builds/SSXa0iNsMi9O9cRkU/openapi.json
