# Popup Script to Display Discount Codes

We’re excited to help you make the most of your referral program! With the Referral Rocket popup script, you can easily display a discount code to users who have been referred by their friends. This guide will walk you through how to use the script, explain its parameters, and help you customize it to fit your brand.

### Step-by-Step Guide to Adding the Popup Script

1. **Copy the Script**: Below is the script provided by Referral Rocket.  Add this on the page referred users will land i.e. the share URL configured in the campaign.

```
<script
  type="text/javascript"
  class="hype_popup"
  campaign-id="campaign-id"
  src="https://app.referralrocket.io/widget/DiscountModal.js"
  defer
></script>
```

2. **Replace the Placeholder Values**:
   * Replace `campaign-id` with your actual campaign ID. This is a unique identifier for your referral or discount campaign.
   * Customize the other attributes (e.g., `popup-header`, `background-color`, `button-color`, etc.) to match your brand and campaign goals.
3. **Add the Script to Your Website**:

   1. Backup Your Theme (Recommended)
   2. In your Shopify Admin, go to: **Online Store → Themes**<br>

      <figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2F8Fz5M2xoqiKNqPrmccp1%2FScreenshot%202025-04-14%20at%203.37.35%20PM.png?alt=media&#x26;token=34f766bc-48e2-49c7-8c40-381be1b981e5" alt=""><figcaption></figcaption></figure>
   3. Click the **⋯ (three-dot menu)** next to your active theme and choose **Duplicate**<br>

      <figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2FmsLM9GSDZi4CHtAHWZJo%2FScreenshot%202025-04-14%20at%203.37.57%20PM.png?alt=media&#x26;token=0258b1f1-1584-4ad8-bed4-a90d4759cade" alt=""><figcaption></figcaption></figure>
   4. This creates a backup in case you want to undo any changes
   5. Edit the Code
      1. After duplicating, go back to your **active theme**\ <br>

         <figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2FiwrsWtIHPa0DxawvZb7f%2FScreenshot%202025-04-14%20at%203.38.22%20PM.png?alt=media&#x26;token=8759e2a5-e406-4ab5-9cb0-3013cea9df75" alt=""><figcaption></figcaption></figure>
      2. Click ⋯ again and select **Edit Code**
   6. Open the theme.liquid File
      1. In the Layout folder, click to open theme.liquid<br>

         <figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2F7paF4ekwMbaM5A6PQIbJ%2FScreenshot%202025-04-14%20at%203.39.59%20PM.png?alt=media&#x26;token=5e3cfe39-06a3-437a-b607-e31a41ff261d" alt=""><figcaption></figcaption></figure>
   7. Paste the Script into the \<head> Section
      1. Scroll to find the \<head> tag and Paste your script just before the closing \</head> tag:<br>

         <figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2FJE5xkt83j88puOpA58SI%2FScreenshot%202025-04-14%20at%203.40.46%20PM.png?alt=media&#x26;token=784cfad4-35fb-496b-909d-7112dd0ca301" alt=""><figcaption></figcaption></figure>
   8. Click Save to apply the changes.
4. **Test the Popup**:
   * Once the script is live, test it by visiting your website as a referred user. The popup should appear with the discount code and the customizations you’ve applied.

<figure><img src="https://346708387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpvWNOwMd3hfowlhBXaA%2Fuploads%2FFRFjPHmUCog3KOY2Z0l5%2FScreenshot%202025-03-02%20at%2011.55.01%20AM.png?alt=media&#x26;token=65472b9c-9364-4e8b-9d0f-bff461225fdf" alt=""><figcaption></figcaption></figure>

### Explanation of Script Parameters

Here’s a breakdown of each attribute in the script and what it does:

| **Attribute**      | **Description**                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------- |
| `campaign-id`      | The unique identifier for your referral or discount campaign. Replace this with your actual campaign ID. |
| `popup-header`     | Sets the heading text inside the popup. Customize this to match your messaging.                          |
| `background-color` | Defines the background color of the popup. Use color names or hex codes.                                 |
| `button-color`     | Specifies the color of the button inside the popup. Use color names or hex codes.                        |
| `button-value`     | Determines the text displayed on the button (e.g., “Buy,” “Shop Now,” etc.).                             |

***

### Customization Tips

* **Brand Consistency**: Use colors (`background-color`, `button-color`) that align with your brand’s visual identity.
* **Clear Messaging**: Customize the `popup-header` and `button-value` to clearly communicate the discount and encourage action.
* **Test Across Devices**: Ensure the popup displays correctly on both desktop and mobile devices.

***

### Troubleshooting

If the popup doesn’t appear as expected:

1. Double-check that the `campaign-id` is correct.
2. Ensure the script is placed just before the closing `</body>` tag.
3. Verify that there are no JavaScript errors in your browser’s console.
