---
url: /guides/api/browser-setup/install-scripts.md
---
# Install Scripts

Learn how to add the Elevar scripts to push events to our Data Layer.

## Overview

Follow this guide to learn how to install the required Elevar scripts on your
site. These scripts enable Elevar to capture Data Layer events, manage user
sessions and consent state, preserve marketing attribution such as UTMs and
click IDs, and forward data to Elevar’s servers for processing.

::: info

The installation process varies slightly depending on your implementation path.
After identifying your
[Client-Side Tracking Method](#client-side-tracking-method), follow the
appropriate section based on your architecture:

* **Headless**: follow the [Headless Installation](#headless-installation)
  section
* **Agnostic**: follow the [Agnostic Installation](#agnostic-installation)
  section

:::

## Client-Side Tracking Method

Elevar supports two methods for client-side tracking. You select your preferred
method during destination setup in the Elevar app, but you must understand your
choice before installing scripts. This is especially important if you choose
Google Tag Manager, which must load before the Elevar scripts.

![Client-Side Tracking Method](/img/client-side-tracking-method.webp)

### Option 1: Using Elevar (Recommended)

Elevar manages client-side tracking automatically. This option:

* Requires no Google Tag Manager account or configuration
* Automatically keeps client-side tracking up to date
* Is ideal for teams that want Elevar to manage the full tracking pipeline

### Option 2: Using Google Tag Manager

You manage client-side tracking using your own GTM account. This option:

* Provides full control over client-side tag configuration
* Requires manual setup and ongoing maintenance of GTM tags
* Is ideal for teams with existing GTM infrastructure or advanced tag management
  needs

::: info

You can select your preferred client-side tracking method during the destination
setup in the Elevar app. The choice doesn't affect server-side tracking, which
Elevar always handles.

:::

## Headless Installation

**Only for Shopify Headless integrations**

Follow these steps to install Elevar scripts on your headless storefront.

::: warning

Complete the [Shopify Source](/guides/api/headless/shopify-source) setup before
proceeding. This creates the connection between your Shopify store and Elevar.
You'll see an option to "Allow Google Tag Manager for client-side tracking",
check this if using GTM, or leave unchecked to let Elevar manage client-side
tracking.

:::

### Install Google Tag Manager:

::: tip

This is only required if you are using GTM for client-side tracking (our
client-side tracking for destinations defaults to our own fully managed
solution).

:::

For web container installation steps, refer to Google's official guide:
https://support.google.com/tagmanager/answer/14847097

::: details Multi-Market Setup

If you're using Shopify Markets with different pixels per market, you'll need
to:

* Load different GTM containers per Shopify Market
* Pass valid market IDs (see [Market ID](/guides/api/headless/market-id))
* Configure your Shopify source and destinations for different markets

:::

### Install Elevar's Browser Scripts:

* Begin on the Elevar Dashboard and use the left-hand navigation menu to access
  "My Tracking". Navigate to your list of sources and access your Non-Shopify
  Subdomain Source.
* Use the "Setup Steps" navigational box to locate and click on the "Prepare
  Your Pages" step.
* Navigate to the section of the page titled "Configure Pages" and copy the
  script code provided.

![Install Elevar's Browser Scripts](/img/headless-install-browser-script.webp)

* After copying the provided script code, paste the code into the `<head>`
  section on all pages that you want to track.

::: details Important Notes

* The script will return a 404 error unless your Shopify source is fully
  installed.
* For headless implementations using Shopify's Storefront API, you must use the
  Cart Object (not Checkout Object) for proper attribution tracking.
* Shopify checkout pages automatically include Elevar scripts via the custom
  pixel, no manual installation needed there.

:::

## Agnostic Installation

**Only for non-Shopify integrations**

Follow these steps to install Elevar scripts on your non-Shopify store.

::: warning

Complete the [API Source](/guides/api/agnostic/api-source) setup before
proceeding. This configures your browser credentials, and you'll see an option
to "Allow Google Tag Manager for client-side tracking", check this if using GTM,
or leave unchecked to let Elevar manage client-side tracking.

:::

### Install Google Tag Manager:

::: tip

This is only required if you are using GTM for client-side tracking (our
client-side tracking for destinations defaults to our own fully managed
solution).

:::

For web container installation steps, refer to Google's official guide:
https://support.google.com/tagmanager/answer/14847097

### Install Elevar's Browser Scripts:

* Begin on the Elevar Dashboard and use the left-hand navigation menu to access
  "My Tracking". Navigate to your list of sources and access your API Source.
* Use the "Setup Steps" navigational box to locate and click on the "Browser
  Setup" tab.
* Copy the script code provided.

![Install Elevar's Browser Scripts](/img/agnostic-install-browser-script.webp)

* After copying the provided script code, paste the code into the `<head>`
  section on all pages that you want to track.

::: details Important Notes

* Since you're managing your own checkout flow, ensure the script is loading on
  all pages, including checkout and order confirmation pages.
* Make sure you generated a browser signing key during the API Source setup,
  this is required for browser-to-server data processing.

:::

## Verification

After installing the scripts, verify they're working correctly:

### Network Verification:

* Begin by opening your website in a browser and access the browser's developer
  tools
* Go to the Network tab and refresh the page
* Filter by `config.js` in the search box
* You should see a request with a **200** status code

![Verification](/img/verification-network.webp)

### Console Verification:

You can also confirm that Elevar’s global objects are available by checking the
Console tab.

| Object                  | Purpose                            |
| ----------------------- | ---------------------------------- |
| ElevarDataLayer         | Main event array, push events here |
| ElevarConsent           | Consent state management           |
| ElevarDebugMode         | Enable/disable debug logging       |
| ElevarInvalidateContext | Force context refresh              |
| ElevarClearStorage      | Clear all storage and reload       |
