Skip to content

Rex, your AI assistant: the busywork, handled. The ideas, yours 👉 Meet Rex

Embed a campaign on your website

Put a campaign inside a page on your website with the embed script or an iframe, check that it works, and fix common problems.

Embedding puts the campaign inside a page on your own website, so visitors play without leaving your site.

Get the embed script

  1. In the editor, open Settings > Embed & URL > Embed script.
  2. Copy the script. It is made for this campaign.
  3. Paste it into your website's HTML where the campaign should appear. Most website builders and shop systems have an HTML or "custom code" block for this.
  4. Publish the campaign, and open the page on your website to check it.

You can also choose Embed as the Promotion method when you publish, and copy the script from there.

Script or iframe?

The Embed script panel gives you two ways to put the campaign on your site:

  • The script (recommended). Place it exactly where the campaign should appear. It gives you everything, including automatic resizing, so the campaign always fits on the page.
  • An iframe, below the script. Use it if your website doesn't allow scripts. Some features, such as automatic resizing, don't work in an iframe. The iframe has a fixed height, so you may need to change the height in the code to fit your campaign.

A popup uses one script for your whole account instead. See Show a campaign as a popup.

Check that it works

  1. Publish the campaign and open the page on your website.
  2. In the editor, click View campaign in the top bar. Once the script has been found on your site, the menu shows an Embed link to the page where the campaign is.
  3. Run the campaign health check. It opens your page in a real browser and checks that the script runs. See Fix editor errors and run a health check.

You can also ask Rex: "Is the embed script working on my site?"

Until the script has been found on any of your websites, the Embed script panel shows Not installed.

The campaign doesn't show

  • The campaign isn't published, or its start date is in the future.
  • The script is in the wrong place. Some website builders move scripts to the bottom of the page or remove them. Use a block made for HTML or custom code.
  • Your cookie banner blocks the script. Some cookie consent tools block scripts they don't know. Allow the Scratcher script in your cookie tool.
  • Your website has a Content Security Policy that blocks Scratcher. Click Does your site use a Content Security Policy? in the Embed script panel. It shows the exact sources your site must allow for the script and for the campaign frame. If you already have a policy, add the sources to it rather than sending a second one. Send it to your web developer.

On the Campaigns page, Embed live URL in a campaign's Actions menu opens the page on your website where the campaign is embedded.

To see where visitors come from, link people to that page with a channel. In the Channels settings, choose Your website and enter the Page where the campaign is embedded (it is filled in automatically the first time the campaign loads there). Each channel link then points to your page, and the script passes the channel on to the campaign. See Track channels, Google Analytics and pixels.

Change campaigns without touching your website

If you run a new campaign in the same spot every month, use a campaign schedule. You install one script once, and it shows the right campaign at the right time. See Rotate campaigns with campaign schedules.

Still need help?

Real people are here to help. If you already use Scratcher, the quickest way is the chat inside the platform.

  • Chat with us

    Log in and click the chat button in the bottom-right corner. Rex answers right away, and our team is a click away.

  • Book a meeting

    A free 30-minute video call with our team: a tour, campaign ideas or help with your setup.

  • Email us

    Write to contact@scratcher.io and we will get back to you.