> For the complete documentation index, see [llms.txt](https://because.gitbook.io/because/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://because.gitbook.io/because/the-because-platform/openapi/replace-image.md).

# Replace Image

Whether you want to test different homepage hero images, update collection page banners, or fine-tune visuals on product pages, this feature ensures your images are optimized for every visitor.

***

## **How Replace Image Campaigns Work**

### 1. **Image Replacement Logic**

* Because replaces existing images on your site with the ones you’ve uploaded, based on predefined rules.
* Supported rules include **URL-based and UTM-based** conditions, ensuring the right image appears for the right audience.
  * Use **URL** to specify which **page** you want to replace the image. For example if you want to replace the image on your home page, add the rule “URL contains /home.”
  * Use a **UTM** **parameter** to specify which **visitors** should see the new image. For example, if you want visitors on your ‘Slim Pants’ to see a lifestyle image if they’re arriving from your Spring Active Email Campaign.
    * Also use this for Preview purposes, as regular Preview does not work

### **2. Automatic Device Detection**

* The script identifies the visitor’s device (desktop or mobile) and dynamically serves the corresponding image for a seamless experience.

***

## **Page Types Supported**

This feature can be used on your **Product Page**, **Collection Page** and your **Home Page.** Replace Image campaigns are ideal for testing and personalizing visuals on your site. Popular use cases include:

### 1. **Replace and Test Hero Images on Your Homepage**

Your homepage hero image is often the first thing visitors see, making it a great place to test and personalize visuals for different audiences.

<figure><img src="/files/hutjGdUTSb9tuTRpLeu5" alt=""><figcaption><p>Replace Image on Homepage</p></figcaption></figure>

* Split test a **lifestyle image** and a **product shot** for example, to see which resonates better with your audience.
* **Email Personalization:**
  * Adapt your Home Page hero (or any other image on site) based on UTM of the email Campaign or Flow the visitor is arriving from to show a **special hero image only to visitors from a specific email or ad campaign** while keeping the default hero image for general traffic.
* **Ad Personalization**
  * Change the **hero image based on the UTM of an ad campaign** to align the website experience with the product featured in the ad.
* **Influencer Personalization**
  * Adapt the homepage hero image based on the **influencer that referred the visitor**.
    * Example: If an influencer is running a promo, show an image of that influencer or a hero banner featuring a **special discount tied to their campaign**. Note: The text would need to be embedded in the image.

### 2. **Experiment with Collection Page Banners**

* Test different banners for collection pages to highlight sales, seasonal themes, or product categories.

<figure><img src="/files/ghD7tLrrUBYY5W41AZcw" alt=""><figcaption><p>Replace Image on Collection Page</p></figcaption></figure>

### 3. **Refine Product Detail Pages (PDPs)**

* Replace the primary image on a PDP (e.g., **lifestyle vs. product shot**) to identify what drives higher engagement or conversions.
* Great for aligning PDP images with **ad creatives** for a seamless shopping experience.

  <figure><img src="/files/tyg11Ijd9QgAH9tQ9HSQ" alt=""><figcaption><p>Replace Image on PDP</p></figcaption></figure>

### **Locations not currently supported:**

* We do not support the adaptation of the hero header copy, buttons, or CTA’s but that is coming soon.
* Videos or Image Carousel
* Collection Page Product Tiles

<figure><img src="/files/TJ54y0XER8xhOZd8q9ZS" alt=""><figcaption><p>Not Yet Supported by Replace Image</p></figcaption></figure>

***

## **Benefits of Replace Image Campaigns**

* **Tailored Visuals:** Serve optimized images for different devices, improving user experience.
* **Simplified Management:** Deployment and updates are easier than ever with the Sync Script handling replacements.
* **Quick and Reliable:** The logic executes instantly to replace images without delays or loading screens.

***

## **Known Limitations & Considerations**

### **1.** **Image Text & Buttons**

* The **Replace Image** feature **only replaces images** and does not change any surrounding text or buttons.
* If text is overlaid on an image (not part of the image file itself), it will remain unchanged.
* If you want to change both the image **and** the text, the new text must be **embedded within the image file** before uploading.

### **2.** **Clickable Images**

* If an image is **hyperlinked**, Replace Image will replace the visual but **won’t change** the link destination.
* The campaign will **retain** the original link settings of the image.

### **3.** **Image Size & Formatting**

* There are **no strict dimension requirements**, but images should have similar dimensions to the original to ensure proper display.
* File size must be **under 1MB**
* You can upload **separate desktop and mobile images** for better optimization.

### **4.** **Previewing Replace Image Campaigns**

* The standard **Rule Tester and Preview Tool do not work** with Replace Image campaigns. We plan to introduce this in V2.
* **Workaround for Testing:**
  * Use a **temporary URL rule** (e.g., /test) and append it to your site’s URL (yourstore.com/test).
  * If this rule is active in the campaign, the image swap will trigger when you visit that URL.
  * You can also use a **test UTM** (e.g., ?utm\_source=because\_test) to verify that the campaign functions correctly.

***

## **Need Help?**

If you have any questions about setting up Replace Image campaigns or managing the [Sync Script](/because/the-because-platform/understanding-script-types-asynchronous-vs.-synchronous.md), reach out to our support team at [**support@trybecause.com**](mailto:support@trybecause.com). We’re here to help!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://because.gitbook.io/because/the-because-platform/openapi/replace-image.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
