---
title: Installing the Mediavine Script Wrapper on a Custom-Built Site
description: Mediavine ads are powered by a single script, called the script wrapper. Once it's on your pages, our team handles the rest — no ad code, ad units, or placement markup needs to be built into your site.
---

[Skip to content](https://help.mediavine.com/installing-the-mediavine-script-wrapper-on-a-custom-built-site#main-content)

English

Show submenu for translations

[![mediavine-horiz-white-pn-RGB-(r)-spacing](https://help.mediavine.com/hs-fs/hubfs/Logos/Mediavine%20Logos/mediavine-horiz-white-pn-RGB-(r)-spacing.png?width=385&height=100&name=mediavine-horiz-white-pn-RGB-(r)-spacing.png)](https://www.mediavine.com/)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Go to mediavine.com](https://www.mediavine.com/)

[Go to mediavine.com](https://www.mediavine.com/)

 Advice and answers from Mediavine!

- There are no suggestions because the search field is empty.

1. [Help Center](https://help.mediavine.com/?hsLang=en)
2. [Launching your Mediavine Ads](https://help.mediavine.com/launching-your-mediavine-ads?hsLang=en)

# Installing the Mediavine Script Wrapper on a Custom-Built Site

## For sites built on custom frameworks, including React, Next.js, Vue, or Angular.

Mediavine ads are powered by a single script, called the **script wrapper**. Once it's on your pages, our team handles the rest — no ad code, ad units, or placement markup needs to be built into your site.

### **1. Locate your script wrapper in your Mediavine dashboard.**

Navigate to Settings \> Ad Setup.

*![](https://help.mediavine.com/hs-fs/hubfs/undefined-Jul-10-2026-02-53-47-6859-PM.png?width=2022&height=344&name=undefined-Jul-10-2026-02-53-47-6859-PM.png)*

It will look something like this:

![HTML Script Wrapper for custom sites example](https://help.mediavine.com/hs-fs/hubfs/HTML%20Script%20Wrapper%20for%20custom%20sites%20example.png?width=602&height=98&name=HTML%20Script%20Wrapper%20for%20custom%20sites%20example.png)

### **2. Add the script wrapper inside the \<head\> of your site.**

The wrapper should be included in the \<head\> of every page where you'd like ads to appear. On most custom sites, this means adding it to your site-wide layout, template, or document component so it's present on all pages automatically.

The script loads asynchronously, so it won't block your page from rendering.

### **3. Using React, Next.js, or another JavaScript framework?**

If your site renders or updates its content in the browser (often called "hydration"), the script wrapper should run **after your page content has finished rendering**. This ensures our technology can see your final page layout and place ads correctly.

Most frameworks provide a built-in way to control when third-party scripts run, and the right approach can vary depending on how your site is built. If you're on one of these frameworks, install the wrapper in the \<head\> as described in Step 2, then reach out to our support team — we've worked with plenty of React and Next.js sites and can help you dial in the setup that works best for yours.

### **4. Email publishers@mediavine.com to confirm your code has been inserted correctly.**

Once the script wrapper is live on your site, our team will verify the installation and work with you to establish your ad placements. That's it — you don't need to add anything else to your code.

 

Using the legacy dashboard? Navigate to **Settings \> Ad Setup**.

![Legacy dashboard ad script](https://help.mediavine.com/hs-fs/hubfs/Legacy%20dashboard%20ad%20script.png?width=670&height=176&name=Legacy%20dashboard%20ad%20script.png)

 

- [Joining Mediavine Ad Management](https://help.mediavine.com/joining-mediavine-ad-management?hsLang=en#main-content)

    - [FAQ](https://help.mediavine.com/joining-mediavine-ad-management?hsLang=en#faq)
- [Launching your Mediavine Ads](https://help.mediavine.com/launching-your-mediavine-ads?hsLang=en#main-content)

    - [Mediavine Control Panel Wordpress Plugin](https://help.mediavine.com/launching-your-mediavine-ads?hsLang=en#mediavine-control-panel-wordpress-plugin)
    - [Installing the Mediavine Script on Non-Wordpress platforms](https://help.mediavine.com/launching-your-mediavine-ads?hsLang=en#installing-the-mediavine-script-on-non-wordpress-platforms)
- [Mediavine Publisher FAQ](https://help.mediavine.com/mediavine-publisher-faq?hsLang=en#main-content)

    - [Getting Started](https://help.mediavine.com/mediavine-publisher-faq?hsLang=en#getting-started)
    - [Site Sales](https://help.mediavine.com/mediavine-publisher-faq?hsLang=en#site-sales)
- [Payment Info](https://help.mediavine.com/payment-info?hsLang=en)
- [Dashboard FAQ](https://help.mediavine.com/dashboard-faq?hsLang=en#main-content)

    - [Getting Started](https://help.mediavine.com/dashboard-faq?hsLang=en#getting-started)
    - [Settings](https://help.mediavine.com/dashboard-faq?hsLang=en#settings)
    - [FAQ](https://help.mediavine.com/dashboard-faq?hsLang=en#faq)
    - [Troubleshooting](https://help.mediavine.com/dashboard-faq?hsLang=en#troubleshooting)
- [Site Health Checks](https://help.mediavine.com/site-health-checks?hsLang=en)
- [Standard Ad Units](https://help.mediavine.com/standard-ad-units?hsLang=en#main-content)

    - [Mediavine Ad Units](https://help.mediavine.com/standard-ad-units?hsLang=en#mediavine-ad-units)
    - [Ad Functionality](https://help.mediavine.com/standard-ad-units?hsLang=en#ad-functionality)
    - [Customizing your ad experience](https://help.mediavine.com/standard-ad-units?hsLang=en#customizing-your-ad-experience)
    - [AMP Ads](https://help.mediavine.com/standard-ad-units?hsLang=en#amp-ads)
    - [Troubleshooting](https://help.mediavine.com/standard-ad-units?hsLang=en#troubleshooting)
- [Site Specific Ad Units](https://help.mediavine.com/site-specific-ad-units?hsLang=en#main-content)

    - [Recipe Ads](https://help.mediavine.com/site-specific-ad-units?hsLang=en#recipe-ads)
    - [Interstitials](https://help.mediavine.com/site-specific-ad-units?hsLang=en#interstitials)
    - [Chicory](https://help.mediavine.com/site-specific-ad-units?hsLang=en#chicory)
    - [Sidebar Alternative](https://help.mediavine.com/site-specific-ad-units?hsLang=en#sidebar-alternative)
    - [Leaderboard](https://help.mediavine.com/site-specific-ad-units?hsLang=en#leaderboard)
- [Video](https://help.mediavine.com/video?hsLang=en#main-content)

    - [Mediavine Universal Player](https://help.mediavine.com/video?hsLang=en#mediavine-universal-player)
    - [Getting Started With Video](https://help.mediavine.com/video?hsLang=en#getting-started-with-video)
    - [Video Features](https://help.mediavine.com/video?hsLang=en#video-features)
    - [Mediavine Video + YouTube](https://help.mediavine.com/video?hsLang=en#mediavine-video-youtube)
    - [Closed Captions](https://help.mediavine.com/video?hsLang=en#closed-captions)
    - [Video Sitemaps](https://help.mediavine.com/video?hsLang=en#video-sitemaps)
    - [Playlists](https://help.mediavine.com/video?hsLang=en#playlists)
- [Optimize Your Ad Performance](https://help.mediavine.com/optimize-your-ad-performance?hsLang=en#main-content)

    - [Using Page-Level Data to Maximize Performance](https://help.mediavine.com/optimize-your-ad-performance?hsLang=en#using-page-level-data-to-maximize-performance)
    - [Tips to Maximize Ad Performance and RPM](https://help.mediavine.com/optimize-your-ad-performance?hsLang=en#tips-to-maximize-ad-performance-and-rpm)
    - [Sweet Land of Money Series](https://help.mediavine.com/optimize-your-ad-performance?hsLang=en#sweet-land-of-money-series)
- [Privacy](https://help.mediavine.com/privacy?hsLang=en#main-content)

    - [Privacy Policy](https://help.mediavine.com/privacy?hsLang=en#privacy-policy)
    - [State Privacy](https://help.mediavine.com/privacy?hsLang=en#state-privacy)
    - [GDPR](https://help.mediavine.com/privacy?hsLang=en#gdpr)
    - [LGPD Lei Geral de Proteção de Dados Pessoais](https://help.mediavine.com/privacy?hsLang=en#lgpd-lei-geral-de-prote%C3%A7%C3%A3o-de-dados-pessoais)
    - [US State Privacy Laws](https://help.mediavine.com/privacy?hsLang=en#us-state-privacy-laws)
- [Ad Quality](https://help.mediavine.com/ad-quality?hsLang=en)
- [SEO Help](https://help.mediavine.com/seo-help?hsLang=en)
- [Site Speed](https://help.mediavine.com/site-speed?hsLang=en)
- [Grow](https://help.mediavine.com/grow?hsLang=en#main-content)

    - [Getting Started](https://help.mediavine.com/grow?hsLang=en#getting-started)
- [PubNation](https://help.mediavine.com/pubnation?hsLang=en#main-content)

    - [Getting Started](https://help.mediavine.com/pubnation?hsLang=en#getting-started)
    - [PubNation Applications and Onboarding](https://help.mediavine.com/pubnation?hsLang=en#pubnation-applications-and-onboarding)
    - [Understanding the Tech](https://help.mediavine.com/pubnation?hsLang=en#understanding-the-tech)
    - [PubNation Ads](https://help.mediavine.com/pubnation?hsLang=en#pubnation-ads)
- [Products](https://help.mediavine.com/products?hsLang=en#main-content)

    - [Mediavine Labs](https://help.mediavine.com/products?hsLang=en#mediavine-labs)
    - [Create](https://help.mediavine.com/products?hsLang=en#create)
- [Advanced](https://help.mediavine.com/advanced?hsLang=en#main-content)

    - [Google Analytics](https://help.mediavine.com/advanced?hsLang=en#google-analytics)
    - [SSL / HTTPS](https://help.mediavine.com/advanced?hsLang=en#ssl-https)
    - [Ads.txt Help!](https://help.mediavine.com/advanced?hsLang=en#ads-txt-help)
- [Conflicts](https://help.mediavine.com/conflicts?hsLang=en#main-content)

    - [Cloudflare](https://help.mediavine.com/conflicts?hsLang=en#cloudflare)
    - [WP Rocket](https://help.mediavine.com/conflicts?hsLang=en#wp-rocket)
    - [Layout Conflicts](https://help.mediavine.com/conflicts?hsLang=en#layout-conflicts)
- [Mediavine Direct](https://help.mediavine.com/mediavine-direct?hsLang=en)
- [Perks & Programs](https://help.mediavine.com/perks-programs?hsLang=en)
- [Navigating the New Dashboard](https://help.mediavine.com/navigating-the-new-dashboard?hsLang=en)

[![mediavine-horiz-black-RGB-2-1](https://help.mediavine.com/hs-fs/hubfs/Logos/Mediavine%20Logos/mediavine-horiz-black-RGB-2-1.png?width=138&height=30&name=mediavine-horiz-black-RGB-2-1.png "mediavine-horiz-black-RGB-2-1")](http://mediavine.com)

mediavine.com Help Center

Copyright © 2026, © Mediavine, Inc.⎪All Rights Reserved