Integration

Use Shifter with Puppeteer

Drive a real Chromium instance through Shifter's residential proxies in minutes. Native --proxy-server support, page.authenticate(), per-tab geo-targeting, and full cluster scaling — no extra plugins required.

Quick Start

Install

npm install puppeteer

Basic Usage

import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=http://p.shifter.io:443"],
  headless: "new",
});

const page = await browser.newPage();
await page.authenticate({
  username: "customer-USERNAME-country-us-sid-123ABC",
  password: "PASSWORD",
});

await page.goto("https://ipinfo.io/json");
console.log(await page.evaluate(() => document.body.textContent));
// {"ip": "154.16.xxx.xxx", "city": "New York", "country": "US", ...}

await browser.close();

Features

Native --proxy-server support — no extra extensions or sidecar processes required
page.authenticate() handles Shifter credentials automatically, including in headless: 'new' mode
Per-tab proxy credentials let you scrape multiple countries in parallel from one browser
Geo-targeting in 195+ countries via username parameters — country, region, city, ASN
Compatible with puppeteer-cluster, puppeteer-extra-plugin-stealth, and the entire Puppeteer plugin ecosystem
Per-request rotation by default, with `sid` for sticky sessions and `ttl-N` for timed pins of N seconds

Examples

Authenticated Proxy + Sticky Session

Pin a residential IP for the entire browser session by adding `sid-XXX` to the username. Add `country-uk-city-london` for geo-targeting and `ttl-300` to keep that IP for 300 seconds.

import puppeteer from "puppeteer";
import { randomBytes } from "node:crypto";

const sid = randomBytes(4).toString("hex");

const browser = await puppeteer.launch({
  args: [
    "--proxy-server=http://p.shifter.io:443",
    "--no-sandbox",
    "--disable-blink-features=AutomationControlled",
  ],
  headless: "new",
});

const page = await browser.newPage();
await page.authenticate({
  username: `customer-USERNAME-country-uk-city-london-sid-${sid}-ttl-300`,
  password: "PASSWORD",
});

await page.setUserAgent(
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
);

// Multi-step flow — every page load reuses the same residential IP.
await page.goto("https://example.co.uk/login", { waitUntil: "networkidle0" });
await page.type("#email", "user@example.com");
await page.type("#password", "secret");
await page.click('button[type="submit"]');
await page.waitForNavigation({ waitUntil: "networkidle0" });

await page.goto("https://example.co.uk/dashboard");
const html = await page.content();
console.log(html.length, "bytes from dashboard");

await browser.close();

Per-Tab Geo-Targeting

Each new page gets its own proxy credentials — let one tab scrape a US site while another scrapes a Japanese one, all through one browser.

import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--proxy-server=http://p.shifter.io:443"],
  headless: "new",
});

async function scrape(country: string, url: string) {
  const page = await browser.newPage();
  await page.authenticate({
    username: `customer-USERNAME-country-${country}-sid-${country}-001`,
    password: "PASSWORD",
  });

  await page.goto(url, { waitUntil: "domcontentloaded" });
  const data = await page.evaluate(() => ({
    title: document.title,
    text: document.body.innerText.slice(0, 200),
  }));

  await page.close();
  return { country, ...data };
}

const results = await Promise.all([
  scrape("us", "https://www.example.com"),
  scrape("jp", "https://www.example.jp"),
  scrape("de", "https://www.example.de"),
  scrape("br", "https://www.example.com.br"),
]);

console.log(results);

await browser.close();

Puppeteer Cluster (parallel scraping)

Scale to dozens of pages in parallel without blowing memory. Pass the proxy via puppeteerOptions and authenticate per page in your task function.

import { Cluster } from "puppeteer-cluster";

const cluster = await Cluster.launch({
  concurrency: Cluster.CONCURRENCY_PAGE,
  maxConcurrency: 10,
  puppeteerOptions: {
    args: ["--proxy-server=http://p.shifter.io:443"],
    headless: "new",
  },
  monitor: true,
});

await cluster.task(async ({ page, data: url }) => {
  await page.authenticate({
    username: `customer-USERNAME-country-us-sid-${url.replace(/\W+/g, "").slice(0, 8)}`,
    password: "PASSWORD",
  });

  await page.goto(url, { waitUntil: "networkidle0" });
  const title = await page.title();
  const html  = await page.content();

  return { url, title, length: html.length };
});

const urls = [
  "https://example.com/category/laptops",
  "https://example.com/category/phones",
  "https://example.com/category/tablets",
  // ... hundreds more
];

const results = await Promise.all(urls.map((url) => cluster.execute(url)));
console.log(results);

await cluster.idle();
await cluster.close();

Stealth Mode + Resource Blocking

Combine Shifter with puppeteer-extra's stealth plugin and block images / fonts / media to scrape 5–10x faster while avoiding Chrome's automation flags.

import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";

puppeteer.use(StealthPlugin());

const browser = await puppeteer.launch({
  args: [
    "--proxy-server=http://p.shifter.io:443",
    "--disable-blink-features=AutomationControlled",
  ],
  headless: "new",
});

const page = await browser.newPage();

await page.authenticate({
  username: "customer-USERNAME-country-us-city-newyork-sid-789GHI",
  password: "PASSWORD",
});

// Block images, fonts, and media for faster page loads
await page.setRequestInterception(true);
page.on("request", (req) => {
  const blocked = ["image", "font", "media", "stylesheet"];
  blocked.includes(req.resourceType()) ? req.abort() : req.continue();
});

await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
const products = await page.$$eval(".product", (els) =>
  els.map((el) => ({
    title: el.querySelector("h2")?.textContent?.trim(),
    price: el.querySelector(".price")?.textContent?.trim(),
  })),
);

console.log(products);

await browser.close();
FAQ

Frequently asked FAQ questions

Common questions about using Shifter with Puppeteer.

Pass --proxy-server=http://p.shifter.io:443 to the browser launch args, then call page.authenticate({ username, password }) on each page before navigating. The same proxy applies to every tab and the credentials handle the basic-auth challenge transparently.

Get started

Start Using Shifter with Puppeteer

Drive headless Chromium through Shifter's 205M+ residential and ISP proxies. Native --proxy-server, per-tab geo-targeting, sticky sessions, and full Puppeteer-cluster support.

Try Shifter for FreeSet up in minutes. Cancel anytime.