Skip to content
SpinLoop

How to add a spin-to-win popup to WordPress

Use a header and footer code plugin, or your child theme's footer.

Written by the SpinLoop team. Last reviewed .

Before you start

  • You are an administrator on the WordPress site.
  • Your game is saved in SpinLoop. Nothing shows to visitors until it is live.

1. Copy your snippet

In SpinLoop, open your game and go to the Install tab. Copy the snippet. It looks like this, with your own game id:

<script src="https://app.getspinloop.com/embed.js" data-campaign="c_0123456789abcdef" async></script>
Example only. Copy your own snippet: the game id is different for every game.

2. Add it to your site

Pick one of these two ways. The first one is easier and survives theme updates.

Option A: a header and footer plugin

  1. In WordPress admin, go to Plugins, then Add New.
  2. Search for a header and footer code plugin, such as WPCode, then install and activate it.
  3. Open the plugin's header and footer screen (in WPCode it is Code Snippets, then Header & Footer).
  4. Paste the snippet into the Footer box.
  5. Save.

Option B: your child theme's footer

Only do this with a child theme, or a theme update will remove the snippet.

  1. Go to Appearance, then Theme File Editor.
  2. Open footer.php in your child theme.
  3. Paste the snippet on the line just above </body>.
  4. Click Update File.

Block themes (the ones edited with the Site Editor) do not have a footer.php to edit, so use Option A.

3. Allow your site's address

In the Install tab, under Where it can run, add your site's address, for example:

https://yourshop.com

If you also use a staging site, add it on its own line.

4. Check it works

  1. Click Test install in the Install tab.
  2. Open your site in another tab and browse a page or two.
  3. The Install tab shows "Installed" once we see the snippet running.

If it does not show

  • Caching plugin. Clear your cache after adding the snippet. If the game still does not show, exclude embed.js from any "delay JavaScript", "defer" or "combine" setting.
  • Security plugin. Some plugins add a Content Security Policy. See the notes in the guide for any other site.
  • Seen it already? The frequency cap hides the game for a while after someone has seen it. Try a private window.

Questions

Does it work with WooCommerce?

Yes. WooCommerce runs on your WordPress theme, so the same snippet covers your shop, product and cart pages.

My caching plugin delays JavaScript. Is that a problem?

It can be. If the game never shows, exclude embed.js from your plugin's delay, defer or combine settings and clear the cache.

Can I use it on WordPress.com?

Only on plans that let you add plugins or custom code. On other plans WordPress.com strips script tags.