How To Embed A Giveaway Into Your Website


Embed your SweepWidget giveaway directly into any webpage on your website. The embed code works on all platforms including WordPress, Shopify, Wix, Squarespace, Webflow, and any custom HTML website.

How to Get the Embed Code

There are two ways to access your giveaway’s embed code:

Option 1: From the Dashboard

  1. Go to your Dashboard
  2. Find the giveaway you want to embed
  3. Click the Embed Into HTML Of Your Site button
  4. A popup will appear with your embed code

Option 2: From the Embed Page

After saving your giveaway or by clicking “View Instructions” from the popup, you’ll see the full embed page with additional options.

The Embed Code

Your embed code looks like this:

<div id="12345-abc123" class="sw_container">
  <script type="text/javascript" src="https://sweepwidget.com/w/j/w_init.js"></script>
</div>

Code Components

ComponentDescription
id="12345-abc123"Your unique giveaway ID
class="sw_container"Required class for styling
w_init.jsSweepWidget’s initialization script

How to Embed the Code

  1. Copy the entire embed code from SweepWidget
  2. Open the page editor on your website where you want the giveaway
  3. Switch to HTML/Code view (not visual editor)
  4. Paste the code where you want the giveaway to appear
  5. Save and publish your page

Platform-Specific Instructions

WordPress

  1. Edit the page or post where you want the giveaway
  2. Add a Custom HTML block (click + and search for “Custom HTML”)
  3. Paste the embed code into the block
  4. Click Update or Publish

Shopify

SweepWidget offers two options for Shopify:

  • Quick Embed Into Custom Shopify Page – Creates a dedicated page automatically
  • Manual HTML embed – Paste code into any page template

For manual embedding:

  1. Go to Online Store > Pages
  2. Create a new page or edit an existing one
  3. Click the <> (Show HTML) button in the editor
  4. Paste the embed code
  5. Save the page

Wix

  1. Open the Wix Editor
  2. Click Add (+) > Embed Code > Embed HTML
  3. Paste the embed code
  4. Resize and position the element as needed
  5. Publish your site

Squarespace

  1. Edit the page where you want the giveaway
  2. Add a Code Block
  3. Paste the embed code
  4. Save and publish

Webflow

  1. Add an Embed element to your page
  2. Paste the embed code
  3. Publish your site

Custom HTML Website

  1. Open your HTML file in a code editor
  2. Paste the embed code inside the <body> tag where you want the giveaway
  3. Save and upload the file to your server

Turn Giveaway Into a Popup

On the embed page, you’ll see a checkbox option: Turn giveaway into a popup

When enabled, the giveaway appears as a popup/modal instead of being embedded inline on the page. This is useful for:

  • Exit-intent popups
  • Triggered popups (on button click)
  • Keeping the main page content visible

Hosted Landing Page Alternative

If you don’t want to embed the giveaway, you can use SweepWidget’s free hosted landing page instead.

Your hosted URL looks like:

https://sweepwidget.com/c/12345-abc123

Simply share this link directly with your audience – no embedding required.

Embed Code Options

You can add optional attributes to customize the embed:

AttributeExampleDescription
data-languagedata-language="Spanish"Set the widget language
data-refdata-ref="ABC123"Track referral source

Example with language:

<div id="12345-abc123" class="sw_container" data-language="Spanish">
  <script type="text/javascript" src="https://sweepwidget.com/w/j/w_init.js"></script>
</div>

Best Practices

  • Use HTML mode – Always paste the code in HTML/code view, not visual editor
  • Test after embedding – Visit the page to ensure the giveaway loads correctly
  • Check mobile display – The widget is responsive but verify it looks good on mobile
  • Place prominently – Put the giveaway where visitors will easily see it
  • Don’t modify the code – Copy and paste exactly as provided

Troubleshooting

Giveaway not appearing

  • Ensure you pasted the code in HTML mode, not visual editor
  • Check that the entire code was copied (including opening and closing tags)
  • Clear your browser cache and refresh the page
  • Verify the giveaway is published and active

Widget appears broken or unstyled

  • Check for CSS conflicts with your theme
  • Ensure no part of the embed code was accidentally modified
  • Try embedding on a simple test page to isolate the issue

Multiple giveaways on one page

You can embed multiple giveaways on the same page – just paste each embed code where you want them to appear. Each giveaway has a unique ID so they won’t conflict.