# Changelog of Similarweb Traffic Monitor - Bulk Domain Estimates (`mmdincer/similarweb-traffic-monitor`) Actor

- **URL**: https://apify.com/mmdincer/similarweb-traffic-monitor/changelog.md
- **Full Actor documentation**: https://apify.com/mmdincer/similarweb-traffic-monitor.md

## Changelog

All notable changes to the Similarweb Traffic Monitor Actor are documented here.

### 1.0.5 - 2026-11-25

- **Root cause of the per-domain challenge: the data call never ran in a page.** The warm session's later domains were read with `context.request`, which shares the cookie jar but never executes the AWS WAF challenge script. `aws-waf-token` is host-scoped, so the token from `www.similarweb.com` did not clear `data.similarweb.com`; every domain after the first was challenged and each challenge retired the session. The data call is now a real page navigation inside the same browser context, so the challenge can run on `data.similarweb.com`, set its own token and reload the JSON.
- **The challenge is finished in-page before rotating.** A challenge page is kept open for up to 25 s while its script solves the proof of work and reloads. Only a challenge that does not finish retires the session. A failed solve no longer burns the whole run after the first domain.
- **Proper data-request headers.** The JSON navigation carries the domain's own page as `Referer`, an `Accept: application/json` header and the warm context's cookies. (No `Origin` override: an extra `Origin` header turned the challenge script into a CORS request and stopped it from running.)
- **Polite pacing.** A jittered pause before every domain after the first; 4 s means 2–6 s. New input `delayBetweenDomainsSeconds` (0–30, default 4) controls it.
- **Session budget tied to the domain count.** The run cap is `min(3 + domains, 15)`. One domain may open at most 3 sessions (its first plus two extra), so a single stubborn domain cannot consume the whole run. `RUN_SUMMARY` now has `browserSessions`, `maxBrowserSessions` and `domainAttempts`.
- **US proxy pinning by default.** New input `proxyCountry` (default `US`) is passed to the residential proxy session as `apifyProxyCountry`; an empty value lets Apify choose. A custom proxy configuration keeps its own country.
- **Page fallback still has a session.** The data call gets at most one rotation, so the embedded-page fallback can still open a session inside the same per-domain budget. The first domain is read from the same page that clears the challenge.
- **No change to charging.** `domain-report` stays 0.009 (PROPOSED), and a blocked, empty or limit-skipped row is never charged.
- Tests add the delay and proxy-country inputs, the pacing order and the solvable-challenge guard.

### 1.0.4 - 2026-11-25

- **Session reuse actually holds.** A session is now kept for every domain and only a confirmed challenge page rotates it. Two things explain the 23 sessions for 3 domains in the live run: the proxy URL was compared per request (a URL that changes per call retires the context every time), and a JSON parse failure or a retryable status retired the session. The URL is now requested only when a session is opened, and a parse failure or retryable status is retried in the same warm context.
- **Session cap.** `maxSessions` (3 by default) and the retry count bound a run. When the site keeps challenging, the Actor stops with a blocked error instead of opening sessions in a loop. `browserSessions` is written to `RUN_SUMMARY` and logged.
- **`monthlyVisits` is filled.** The website page fallback used to discard its plotted history (`monthlyVisits: []`); it now maps the history series and scales it to the reported monthly total. The data endpoint mapping also accepts list shapes, nested values and string dates.
- **`visitsChangePercent` is filled on a baseline.** It now comes from the public month-over-month figure (the data endpoint's last two months, or the page's own change), so the first run is not an empty change field. A saved run still wins, because it compares the same source across time.
- **No bogus country rank.** The live endpoint returns `CountryRank` as a single `{ "Rank": n }`; the old code turned that into a fake `"RANK"` country. It is now skipped unless a country code is present.
- **No charge without traffic numbers.** A response that carries only ranks and no visits is now a free `no_data` notice, so `domain-report` is charged only when a traffic number was read.
- Tests add a live-shaped data-endpoint fixture, the page history mapping, the single-month case, the nested list shape and the baseline change.
- `domain-report` stays 0.009 and is marked PROPOSED in `pricing-ppe.json`.

### 1.0.3 - 2026-11-25

- **Hotfix sync from the live Apify build.** The Playwright base image runs as `myuser`, so the Dockerfile now copies `package*.json` and the sources with `--chown=myuser:myuser`; `npm install` no longer fails with EACCES.
- **Hotfix sync: proxy session ids.** Apify proxy session ids must match `/^[\w._~]+$/`; the old `similarweb-<n>` was rejected. Sessions now use `similarweb_<n>`, produced by `proxySessionId` in `src/browser.js`.
- **Hotfix sync: proxy credentials.** Playwright ignores credentials embedded in the proxy server URL, so every navigation hung until the 60 s timeout. `toPlaywrightProxy` now splits the credentials from the server URL and passes them as `username` and `password`.
- **Cost cut: one WAF clearance per browser session.** The Actor loads one similarweb.com page to clear the AWS WAF challenge, then calls `data.similarweb.com/api/v1/data` from inside the same browser context for every domain, reusing the WAF cookies. One browser session is kept across domains and rotated only on a challenge. The website page is a fallback when the JSON call fails.
- **Lighter page loads.** Scripts, stylesheets, images, fonts, media and the site's own data calls are blocked; only the challenge script and challenge hosts are allowed. The route filter is a pure, tested function.
- **Memory default 1024 MB** (was 2048). A local Chromium with one page used 292 MB plus 83 MB for Node; the compute part of the bill halves.
- **Price proposal: `domain-report` 0.009 flat on every tier** (was 0.04), marked PROPOSED in `pricing-ppe.json`. The 24 November live run cost $0.0669 for 2 domains ($0.033 per domain); the new design estimates $0.0005–$0.001 per domain at 50 domains and $0.002–$0.003 at 2 domains.
- Tests add the route filter, the website/data URL pair and the 1 GB default.

### 1.0.2 - 2026-11-25

- The fetching layer now uses a real headless Chrome (`playwright-core` on the `apify/actor-node-playwright-chrome:22-1.65.1` image) instead of plain HTTP requests. Plain HTTP through the residential proxy still received HTTP 403 from the Similarweb WAF.
- The browser loads the public `similarweb.com/website/<domain>/` page, which solves the WAF challenge and embeds the estimate the page itself renders. The Actor reads that embedded data instead of a cross-origin JSON call, because the undocumented `data.similarweb.com` endpoint is blocked cross-origin and from many addresses. The JSON endpoint is kept as a fallback.
- One Chromium instance is reused per run, one page is open at a time, and each session gets a browser fingerprint from Apify's `fingerprint-generator` (the generator behind browser-pool fingerprints). Images, fonts, media and stylesheets are blocked to save proxy bandwidth.
- A challenge or a block status retires the browser session, picks a new proxy session id and retries with backoff. A block that survives the retries writes a `blocked` error row and fails the run; it is never a zero-traffic claim.
- Memory defaults to 2048 MB (minimum 1024 MB, maximum 4096 MB) and the Docker base image is pinned to the Playwright version in `package.json`.
- Price proposal: `domain-report` changes from 0.003 to 0.04, because a domain now costs a full WAF-clearing page load plus residential traffic. Marked PROPOSED in `pricing-ppe.json`; needs owner approval.
- Tests cover challenge detection and the JSON adapter.

### 1.0.0 - 2026-11-25

- First version. Bulk public Similarweb estimates for up to 50 domains: monthly visits, global and category rank, traffic sources, top countries, top keywords, bounce rate, pages per visit and time on site.
- Month-over-month change mode keeps the latest visits and snapshot month per domain and writes only new domains or moves past the threshold.
- Apify residential proxy support, retries with backoff, and a blocked or data-less domain is written as an error or notice row instead of a zero-traffic claim.
