Google Tag Manager Integration
Plan required: Business or higher.
Google Tag Manager (GTM) lets you manage marketing tags without editing code. When you connect GTM to SweepWidget, your container loads on your giveaway and receives SweepWidget events in the dataLayer. You can then send them to Google Analytics 4, ad platforms and other tools.
What You’ll Track with Google Tag Manager
Once integrated, GTM receives events for:
- Page loads – every time someone views your giveaway
- Giveaway entries – when an entrant submits the entry form (successes and errors)
- Entry method completions – each bonus action an entrant completes (successes and errors)
- Widget interactions – refreshes and logouts
All SweepWidget action events start with sw_sweepwidget_. The page-load event is named SweepWidget.
Where the container runs
Your GTM container loads inside SweepWidget’s page:
- On the hosted landing page (sweepwidget.com/c/…), it runs on that page.
- On an embedded giveaway, it runs inside the giveaway iframe (also on sweepwidget.com), not on your website’s page. The GTM container on your own website does not receive these events.
If you need giveaway events on your own website’s page, use the JavaScript callbacks described in the Webhooks guide (Enterprise plan).
Setting Up GTM Integration
Step 1: Open the Google Tag Manager settings
In your SweepWidget dashboard, click API Integrations in the left menu. Then click Google Tag Manager.


Step 2: Enter Your Container ID
In the Container ID field, enter your GTM Container ID (it starts with “GTM-“, like GTM-XXXXXX).

Click Save Changes.
Important: only enter your Container ID (GTM-XXXXXX), not the entire GTM script.
Finding Your GTM Container ID
Step 1: Access Google Tag Manager
Go to tagmanager.google.com and sign in with your Google account.
Step 2: Create or Select a Container
If you already have a GTM container, select it from your account list. If not, create a new container:
- Click Create Account (if you don’t have one) or Create Container (if adding to an existing account)
- Enter an account name and select your country
- Enter a container name (usually your website domain)
- Select Web as the target platform
- Click Create and accept the terms
Step 3: Copy Your Container ID
Your Container ID is shown in the top right corner of the GTM interface (format: GTM-XXXXXX). Copy it and paste it into the SweepWidget integration field.
Setting Up Tags in GTM
Create Data Layer Variables
Create three variables of type Data Layer Variable with these names: eventCategory, eventAction and eventLabel.
Create a Trigger for SweepWidget Events
- In GTM, go to Triggers and click New
- Select Custom Event as the trigger type
- In the Event Name field, enter: sw_.* (this matches all SweepWidget action events)
- Check Use regex matching
- Name your trigger (e.g., “SweepWidget – All Events”)
- Click Save
To also catch page loads, create a second Custom Event trigger with the Event Name SweepWidget (no regex).
Create a Tag (Example: Send to Google Analytics)
- Go to Tags and click New
- Select Google Analytics: GA4 Event
- Enter your GA4 Measurement ID
- Set Event Name to {{Event}}
- Add Event Parameters: – Parameter Name: event_category, Value: {{eventCategory}} – Parameter Name: event_label, Value: {{eventLabel}}
- In the Triggering section, select your “SweepWidget – All Events” trigger
- Name your tag (e.g., “SweepWidget to GA4”)
- Click Save
Testing Your GTM Setup
Using Preview Mode
- In GTM, click Preview in the top right corner
- Enter your giveaway’s hosted landing page URL (sweepwidget.com/c/…)
- Click Connect
- Interact with your giveaway (enter, complete actions)
- In the Tag Assistant panel, you should see events such as sw_sweepwidget_enter_giveaway and sw_sweepwidget_insert_entry
- Click each event to check that your tags fire
Publishing Your Container
Once everything works in Preview mode:
- Click Submit in the top right
- Add a version name and description (e.g., “Added SweepWidget tracking”)
- Click Publish
Events Pushed to dataLayer
| Event name | When it fires | eventCategory | eventLabel examples |
|---|---|---|---|
| SweepWidget | Giveaway page loads | Widget Page Load | Giveaway title |
| sw_sweepwidget_enter_giveaway | Entrant submits the entry form | Enter giveaway | “Enter giveaway success”, “Enter giveaway error: duplicate IP address” |
| sw_sweepwidget_insert_entry | Entrant completes a bonus entry method | Insert entry | “Insert entry: visit_a_page”, “Insert entry error: duplicate” |
| sw_sweepwidget_login_error | Entry form blocked by a security check | Insert entry | “Insert entry error: VPN detected” |
| sw_sweepwidget_reload_widget | Widget is refreshed | Reload widget | “Reload widget success” |
| sw_sweepwidget_logout | Entrant logs out | Logout | “Logout success” |
| sw_sweepwidget_duplicate_wallet_address | Crypto wallet address already used | Duplicate crypto wallet address | |
| sw_sweepwidget_invalid_phone_number | Invalid phone number | Insert entry | “Insert entry error: invalid phone number” |
There is no separate login-success event.
dataLayer Structure
Each action event includes:
- event – event name (sw_ prefix, lower case, underscores)
- eventCategory – category of the action (see the table)
- eventAction – the original event name (e.g., “SweepWidget insert entry”)
- eventLabel – details, including success or the error reason
Example dataLayer Push
When an entrant completes a Visit a Page entry method, the dataLayer receives:
{
event: "sw_sweepwidget_insert_entry",
eventCategory: "Insert entry",
eventAction: "SweepWidget insert entry",
eventLabel: "Insert entry: visit_a_page"
}
The text after “Insert entry: ” is SweepWidget’s internal name for the entry method.
Advanced Use Cases
Sending Events to Multiple Platforms
With GTM, you can send the same SweepWidget events to several platforms at once:
- Google Analytics 4
- Meta Pixel
- LinkedIn Insight Tag
- Hotjar
- Any custom tracking solution
Create multiple tags that use the same SweepWidget trigger.
Creating Conversion Triggers
- For giveaway entries, create a Custom Event trigger for sw_sweepwidget_enter_giveaway and add the condition eventLabel equals Enter giveaway success. Without this condition the trigger also fires on blocked entries.
- For bonus actions, use sw_sweepwidget_insert_entry with eventLabel starting with **Insert entry: **.
- Use these triggers to fire conversion tags for Google Ads, Facebook Ads, etc.
Troubleshooting
Events Not Appearing in Preview Mode?
- Verify Container ID: make sure you entered the correct GTM-XXXXXX ID in SweepWidget and clicked Save Changes.
- Check the plan: GTM needs the Business plan or higher.
- Check the security setting: if Remove SweepWidget Google Analytics tracking is ticked on the giveaway’s Security tab, no SweepWidget events are pushed. Untick it to use GTM.
- Preview the hosted page: for embedded giveaways the container runs inside the giveaway iframe. Preview the hosted landing page URL instead of your website page.
- Check dataLayer: open the browser console on the hosted landing page, type dataLayer and press Enter to see if events are being pushed.
Tags Not Firing?
- Check trigger configuration: use sw_.* with regex matching enabled.
- Use the real event names from the table above. Names such as sw_contest_entry or sw_user_login do not exist.
- Verify tag setup: ensure your tag has the correct trigger attached.
- Publish your container: Preview mode shows what will happen; you need to publish for changes to go live.
Best Practices
- Use consistent naming for SweepWidget tags and triggers.
- Create Data Layer Variables for eventCategory, eventAction and eventLabel.
- Always test in Preview mode before publishing.
- Use GTM’s version descriptions to document your changes.
- Group related tags, triggers and variables into folders.
Need Help?
- Contact SweepWidget support through the Contact Us page in your dashboard
- Visit Google’s GTM Quick Start Guide for help setting up your container