> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invoca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Implementing the Invoca Location Proxy

> Add a small script to your site and update your Invoca Tag settings so Invoca reads location data from a source you control instead of the browser's default location object.

## Overview

Some browser privacy changes restrict how scripts like the Invoca Tag can read the page's URL and location information directly from the browser. The Invoca Location Proxy works around this by having your own website define the location data in a variable the Invoca Tag can read, instead of the tag reading it directly from the browser. Implementing it is a two-step process: add a script to your site, then update your Invoca Tag settings to reference the proxy instead of the browser's default location object.

## Prerequisites

Before you begin, you'll need:

* The ability to add a small script to your website's HTML or a JavaScript file hosted on your primary domain.
* Access to your Invoca Tag settings, since you'll need to update any Data Source Name fields or custom code blocks that currently reference the browser's location object directly.

## Step 1: Update your website HTML

Add the following script to your page. It must load before the Invoca JavaScript loads:

```html theme={null}
<script>
window.InvocaLocationProxySource = JSON.stringify(window.location);
</script>
```

This code is recommended to be placed directly in your page HTML or in a JavaScript file hosted on your primary domain, rather than a third-party or subdomain file, so the browser treats it as first-party data.

## Step 2: Update your Invoca Tag settings

If your Invoca Tag references `location.href` or `location.search` in any Data Source Name field or in a custom code block, update those references to use the proxy object, `Invoca.locationProxy`, instead. This ensures Invoca reads location data from the source you defined in Step 1 rather than the browser's default location object.

Common replacements:

| Standard reference | Replace with |
| - | - |
| `location.href` | `Invoca.locationProxy.href` |
| `window.location.hostname` | `Invoca.locationProxy.hostname` |
| `window.location.search` | `Invoca.locationProxy.search` |

## Why this matters

Without this proxy, browser privacy restrictions can prevent the Invoca Tag from reliably reading location-based data directly from the browser, which can affect attribution accuracy. By having your own site expose location data through `window.InvocaLocationProxySource` before the tag loads, and pointing your tag configuration at `Invoca.locationProxy` instead of the browser's native location object, you keep the same data available to Invoca in a way that's compatible with current browser privacy behavior.

Complete both steps together. Adding the script without updating your tag settings, or updating your tag settings without adding the script, means the proxy object won't have any data to read from.


## Related topics

- [Reverse Proxy Implementation Guide](/s/article/reverse-proxy-implementation-guide.md)
- [Using Real-Time Routing Webhooks to Include Invoca Data With Third-Party Call Routing](/s/article/real-time-routing-webhooks.md)
- [Navigating Safari 26.2 Privacy Updates with Invoca](/s/article/navigating-safari-26-2-privacy-updates.md)
- [403 Error Logging Into Invoca via SAML/SSO: Invalid Signature](/s/article/403-error-saml-sso-invalid-signature.md)
- [Define Locations for Call Treatment Forwarding](/s/article/define-locations-call-treatment-forwarding.md)
