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
- Go to your Dashboard
- Find the giveaway you want to embed
- Click the Embed Into HTML Of Your Site button
- 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
| Component | Description |
|---|---|
id="12345-abc123" | Your unique giveaway ID |
class="sw_container" | Required class for styling |
w_init.js | SweepWidget’s initialization script |
How to Embed the Code
- Copy the entire embed code from SweepWidget
- Open the page editor on your website where you want the giveaway
- Switch to HTML/Code view (not visual editor)
- Paste the code where you want the giveaway to appear
- Save and publish your page
Platform-Specific Instructions
WordPress
- Edit the page or post where you want the giveaway
- Add a Custom HTML block (click + and search for “Custom HTML”)
- Paste the embed code into the block
- 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:
- Go to Online Store > Pages
- Create a new page or edit an existing one
- Click the <> (Show HTML) button in the editor
- Paste the embed code
- Save the page
Wix
- Open the Wix Editor
- Click Add (+) > Embed Code > Embed HTML
- Paste the embed code
- Resize and position the element as needed
- Publish your site
Squarespace
- Edit the page where you want the giveaway
- Add a Code Block
- Paste the embed code
- Save and publish
Webflow
- Add an Embed element to your page
- Paste the embed code
- Publish your site
Custom HTML Website
- Open your HTML file in a code editor
- Paste the embed code inside the
<body>tag where you want the giveaway - 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:
| Attribute | Example | Description |
|---|---|---|
data-language | data-language="Spanish" | Set the widget language |
data-ref | data-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.