Skip to main content

New Introducing the Holiday Hub — seasonal templates and ideas to plan your holiday campaigns in one place.Introducing the Holiday Hub.Explore the Holiday Hub

How to embed a campaign inline (2.0)

All plans Last reviewed

An inline embed shows your campaign inside a page on your website, such as below an article or in a sidebar. With the global embed code on your site, choose the spot with the Visual Picker Tool or a CSS selector. Or paste a div and script into one page. If your site won't accept scripts, use an iframe instead.

What you can do

ToUse
Click the spot on your page where the campaign goesThe Visual Picker Tool. Recommended.
Set the spot with a CSS selectorEnter the placement yourself.
Paste the campaign into one page, without the global embed codeAlternative to using the global embed code.
Embed on a site that won't accept scriptsAn iframe.

Before you start

  • For the Visual Picker Tool or a CSS selector, install the global embed code first. It goes on your site once, and loads every ShortStack campaign. See How to install our global embed code (2.0). To skip it, paste a div and script into the page instead. If your site won't accept scripts at all, use an iframe.
  • Have the full address of the page where the campaign should appear, such as yoursite.com/giveaway.

Place it with the Visual Picker Tool

  1. In the Campaign Builder, click Publish Campaign, or the Publications icon (a bookmark) at the top right.
  2. Choose Embed Inline.
  3. Paste the full address of the page where the campaign should appear, and click Continue.
  4. Choose Install Global Embed Code. If the code isn't on your site yet, copy it into your site now.
  5. Click Validate to check the code is installed. Then click Continue.
  6. Check the page address, then click Open Page & Select Placement.
  7. Your page opens. Click an element, then use your keyboard's arrow keys, or the arrows on screen, to fine-tune the spot. Click Clear to start again.
  8. Click Confirm. The tab closes and you're back in the Campaign Builder.
  9. Click Publish.

The campaign can take a few minutes to appear on your site. You can close the Publications panel while it shows Updating.

Enter the placement yourself

If you know the CSS selector for the spot you want:

  1. Follow the first five steps above.
  2. Click I want to skip this step and manually install the campaign to my page.
  3. Under Option Settings, enter the CSS selector and where the campaign goes in relation to it.
  4. Click Publish.

Alternative to using the global embed code

If you'd rather not install the global embed code, paste two pieces of code into the page instead.

  1. Click Publish Campaign, choose Embed Inline and click Continue.
  2. Add your site or choose it from the list. For a new site, enter its domain, then choose Install on Each Page.
  3. Click Continue, enter the exact address of the page, and click Publish. The code appears only after you publish.
  4. Copy the Campaign code, a <div>, and paste it into your page where the campaign should appear.
  5. Copy the Page embed script, and paste it anywhere on the same page. For the fastest loading, put it in the <head> or just after the opening <body> tag.
  6. Publish your site.

The publication shows Pending Install until the code is on your page. Paste both pieces: the <div> on its own shows nothing, because the script is what loads the campaign into it.

Use an iframe instead

If your site won't accept the embed script, use a self-contained <iframe>. It doesn't need the global embed code.

  1. Click Publish Campaign, choose Embed Inline and click Continue.
  2. Add your site or choose it from the list. For a new site, enter its domain, then choose Install on Each Page.
  3. Click Continue, enter the exact address of the page, and click Publish. The code appears only after you publish.
  4. Between the two code snippets, check I don't want to use the embed script. Use iframe code instead (iframe height is fixed).
  5. Copy the iframe code into your page, and publish your site.

The setting is saved with the publication: it shows a No Script badge in the Publications panel, and its gear icon keeps showing the iframe instructions.

If something goes wrong

What you seeWhat to do
Validate says the code isn't foundCheck the global embed code is on the page, that you published your site, and that any caches are cleared. See How to install our global embed code (2.0).
The campaign doesn't appear on your pageGive it a few minutes, then check the Publications panel no longer shows Updating. See Nothing appears where the campaign should be.
You pasted the <div>, but nothing showsThe page also needs the embed script. Paste the Page embed script too, or install the global embed code.
The picker keeps choosing small elementsUse the width slider in the picker's advanced settings.
The campaign is cut off, or leaves a gap on phonesAn iframe has a fixed height. Use the global embed code instead. See Troubleshooting embed issues.

FAQs

Which placement method should I use?

The Visual Picker Tool. You click the spot on your own page, with no code. Use a CSS selector if you or your developer prefer to set the spot yourself, or a div and script if you'd rather not install the global embed code.

How long does it take for the campaign to appear on my site?

A few minutes, depending on the campaign's size. You can close the Publications panel while it shows Updating. It won't affect the campaign, and you can check the status any time.

Can I embed the same campaign on more than one page?

Yes. Publish it again for each page. Each page needs the global embed code, or its own div and script.

Was this helpful?