Geolocation targeting
Find out how to use the location parameters to access web data from specific locations.
You can specify a location for your Unblocking Browser session by adding the p_cc, p_city, or p_state parameter to your connection URL:
p_cc– selects the country, using 2 letter country code (e.g., US, DE, FR). If no country is specified, the system will automatically assign one based on availability.p_city– selects the city written in lowercase (e.g., berlin, los_angeles, etc.). You must also specify eitherp_ccorp_statep_state– selects a state (only for US) when used as a lowercase name (e.g., texas, ohio)
Here are the code samples for country targeting:
from playwright.sync_api import sync_playwright
username = "your-username"
password = "your-password"
endpoint = "ubc.oxylabs.io"
cc = "US" # Replace with desired 2-letter country code
browser_url = f"wss://{username}:{password}@{endpoint}?p_cc={cc}"
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(browser_url)
page = browser.new_page()
page.goto('https://example.com')
browser.close()import { chromium } from 'playwright';
(async () => {
const username = 'your-username';
const password = 'your-password';
const endpoint = 'ubc.oxylabs.io';
const cc = 'US'; // Replace with desired 2-letter country code
const browserUrl = `wss://${username}:${password}@${endpoint}?p_cc=${country}`;
const browser = await chromium.connectOverCDP(browserUrl);
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();
})();Note: if p_state and p_cc are both specified, p_state takes priority and p_cc is ignored.
Last updated
Was this helpful?

