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

# Adding Scripts

> Add tracking pixels and custom scripts, site-wide or per page.

Scripts are snippets of code that extend your store's functionality and tracking capabilities. They let you connect third-party tools, run custom interactions, and measure performance across your funnel.

## Why ecommerce stores need scripts

Scripts power essential parts of your marketing stack. Without them, you can't track conversions, optimize campaigns, or create personalized experiences.

**Tracking and measurement**: Scripts from analytics platforms and ad networks (Meta Pixel, Google Analytics, TikTok Pixel, X Pixel) capture visitor behavior, clicks, and purchases. This data feeds into your CAC, CVR, and ROAS calculations so you can see what's working.

**Interactive experiences**: Page-level scripts enable quizzes, personalization apps, exit-intent pop-ups, and cart abandonment flows. These tools improve conversion rates by creating more engaging, tailored experiences for visitors.

**Integration with marketing tools**: Scripts connect your store to email platforms, SMS tools, sign-up popup tools, and other services that power your customer acquisition and retention workflows.

## When to use site-wide vs. page-level scripts

> [tab] Site-wide scripts
>
> Use site-wide scripts for tools that need to track activity across your entire store.
>
> **Best for:**
>
> * Analytics and tracking pixels (Meta Pixel, Google Analytics, TikTok Pixel, X Pixel)
> * Performance measurement (CTR, CVR, conversion tracking)
> * Tools that should fire on every page visit
> * Universal integrations (payment processors, shipping calculators)

> [tab] Page-level scripts
>
> Use page-level scripts for interactions specific to individual pages.
>
> **Best for:**
>
> * Quizzes and interactive surveys
> * Personalization apps
> * Exit-intent pop-ups
> * Page-specific tracking events
> * Product finders or recommendation tools

## Where to add scripts in Replo

### Site-wide scripts

Add site-wide scripts in **Site settings**, under the **Scripts & Pixels** tab. These scripts load on every page of your site, making them ideal for marketing performance tracking.

> [!NOTE]
>
> Pixels in Scripts & Pixels load on every page of the site. To use a different
> pixel on some pages, for example a separate Meta pixel for one landing page,
> put those pages on their own site. Each site has its own Scripts & Pixels and
> its own domain, so those pages move to a different address.

**1. Open Site settings**

In the [Site Builder](https://docs.replo.app/apps/website-builder.md), open **Settings** in the top bar and choose **Site settings**.

**2. Open the Scripts & Pixels tab**

Common pixels (Google Analytics, Meta, etc.) have built-in entries; select one and add your ID. There's also a cookie consent control for GDPR/CCPA, which is where you turn on Replo's banner or [connect a third-party consent tool](#use-a-third-party-consent-tool).

If you have Google Tag Manager installed, Replo checks whether its container already fires the pixel you're about to add. For Elevar or Segment, Replo warns you to check manually before connecting, so you don't send the same event twice.

Select **Replo pixel** to see how it connects and the events it tracks. Its page also has a switch for adding tracking parameters (`rsid`, `rclid` and `rpid`) to links that leave your site. It's on by default. Use it when you have the Replo pixel on multiple domains. If you turn it off, UTMs and other URL parameters still pass through any links, but linked sites which use the Replo pixel may double-count visitors. The change takes effect the next time you publish.

![The Scripts & Pixels tab in Site settings, with a cookie consent control and built-in entries for common pixels](https://docs.replo.app/images/cropped/site-settings-pixels.png)

**3. Add a custom script**

For anything not listed, paste the script code, or ask Replo in chat to add it for you.

> [!TIP]
>
> Site-wide scripts are best for marketing performance tracking tools that need
> to measure activity across your entire funnel, pixels, analytics platforms,
> and attribution tools.

### Use a third-party consent tool

Replo has its own [cookie consent](https://docs.replo.app/features/cookie-consent.md) banner. If your store already runs a consent tool, connect it under **Cookie consent** in **Scripts & Pixels** instead, and your scripts wait for that tool's answer. See how to set up each one:

> [card] [Cookiebot](https://docs.replo.app/integrations/cookiebot.md)
>
> Scripts wait for their Cookiebot category.

> [card] [Usercentrics](https://docs.replo.app/integrations/usercentrics.md)
>
> Scripts wait for the Usercentrics service you choose for each one.

For another tool that blocks scripts one at a time, such as Termly or CookieYes, ask Replo in chat to connect it.

### Load Google Analytics through Google Tag Manager

If your Google Tag Manager container already has a Google tag for your GA4 measurement ID, set **Loaded by** to Google Tag Manager on Google Analytics 4. Replo then stops loading Google's `gtag.js` a second time and sends its GA4 events (page views, add to cart, purchases) through the copy your container loads. This keeps your site from loading the same script twice, which slows down your pages.

> [!NOTE]
>
> **Loaded by** is available for Google Analytics 4 only.

**1. Connect Google Tag Manager**

In **Scripts & Pixels**, select **Google Tag Manager** and add your container ID (`GTM-XXXXXXX`).

**2. Open Google Analytics 4**

Select **Google Analytics 4**. Connect it with your measurement ID
(`G-XXXXXXXXXX`) if you haven't yet.

**3. Set Loaded by**

Under **Loaded by**, choose **Google Tag Manager**. The change saves right away. Republish your site for it to go live.

Keep these in mind:

* **Keep the Google tag in your container.** Replo no longer loads `gtag.js`, so if you pause or delete that tag in Google Tag Manager, GA4 events stop sending.
* **Consent follows your container.** Replo only loads Google Tag Manager when the visitor's consent allows it. From there, the tag's own consent settings in your container decide when GA4 runs.
* **Watch for double page views.** If the Google tag in your container also sends a page view, turn that off in Google Tag Manager, since Replo already sends one.

Choose **Other site code** when something other than Google Tag Manager loads `gtag.js`, such as a custom script you added. The same rules apply: if that code stops loading it, GA4 events stop sending. Choose **Replo** to go back to Replo loading it.

### Page-level scripts

For page-specific interactions like quizzes, personalization apps, pop-ups, or custom tracking events, add scripts directly to individual pages through Replo.

**1. Open your page**

In the Site Builder, open the page where you want to add the script.

**2. Provide your script snippet**

Prompt Replo with the script you need to add and paste in the correct code
snippet. For example: `text Add this quiz script to the page: insert [your
      script code] `

**3. Verify the script is added**

The script will be integrated into your page. Republish your page to make it live.

> [!TIP]
>
> Page-level scripts are perfect for tools that should only run on specific
> pages. This includes quizzes, product finders, exit-intent pop-ups, and
> personalization apps that create unique shopping experiences per page.

***

## FAQ

> [accordion] Can I add the same script both site-wide and on a specific page?
>
> Typically, no. Most scripts should only be added once. Adding a script in both places usually results in duplicate tracking, which skews your data. In addition,  adding unnecessary scripts globally slows down your site. Choose site-wide if you need it everywhere, or page-level if it's page-specific.

> [accordion] Why does Replo warn that a pixel might already be firing?
>
> Google Tag Manager, Elevar, and Segment can all fire a pixel (Meta, GA4,
> TikTok, Pinterest, Snapchat, Reddit, X) on your behalf. If you also add that
> pixel directly in Scripts & Pixels, every event fires twice and your ad
> platform reports inflated numbers. Replo reads your Google Tag Manager
> container to check which pixels it already fires; Elevar and Segment don't
> expose that config publicly, so Replo flags them as worth checking by hand.
> Keep the pixel in only one place.

> [accordion] Do I need to republish after adding scripts?
>
> Yes. After adding scripts, whether site-wide or page-level, you need to
> republish your pages for the changes to go live. Site-wide scripts apply to
> all pages on your next publish; page-level scripts only apply to the specific
> page you updated.

> [accordion] How do I verify my scripts are working?
>
> Most tracking scripts have browser extensions or test tools (Meta Pixel Helper, Google Tag Assistant) that verify scripts are firing correctly. Check your analytics dashboard or ad platform to confirm events are being tracked. For page-level scripts, test the functionality directly on your published page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.