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.

It will look something like this:

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.
