Google Tag Manager Integration
Google Tag Manager (GTM) is a powerful tag management system that allows you to manage and deploy marketing tags (snippets of code) on your website without modifying the code directly. By integrating GTM with your SweepWidget giveaways, you can track user interactions, connect multiple analytics platforms, and customize your tracking setup with precision.
What You’ll Track with Google Tag Manager
Once integrated, GTM will receive events pushed to the dataLayer for:
- Page views – Every time someone views your giveaway page
- User logins – When participants authenticate to enter
- Contest entries – When users submit their entry
- Entry method completions – Each individual action users complete (follow, like, share, etc.)
- Widget interactions – Refreshes, errors, and other user actions
All SweepWidget events are prefixed with sw_ to keep them organized and prevent conflicts with other tags.
Setting Up GTM Integration
Step 1: Navigate to Google Tag Manager Integration
In your SweepWidget dashboard, go to API Integrations from the left sidebar menu.

Click on Google Tag Manager to open the integration settings.

Step 2: Enter Your Container ID
In the Container ID field, enter your GTM Container ID (it starts with “GTM-” followed by letters and numbers, like GTM-XXXXXX).
Click the Update button to save your settings.
Important: Only enter your Container ID (GTM-XXXXXX), not the entire GTM script.
Finding Your GTM Container ID
If you don’t have a GTM Container ID yet, follow these steps:
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 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 displayed in the top right corner of the GTM interface (format: GTM-XXXXXX). Copy this ID and paste it into the SweepWidget integration field.
Setting Up Tags in GTM
After connecting SweepWidget to GTM, you’ll need to create tags and triggers in GTM to use the event data.
Creating a Trigger for SweepWidget Events
- In GTM, go to Triggers and click New
- Click on the trigger configuration area
- Select Custom Event as the trigger type
- In the Event Name field, enter:
sw_.*(this will match all SweepWidget events) - Check Use regex matching
- Name your trigger (e.g., “SweepWidget – All Events”)
- Click Save
Creating a Tag (Example: Send to Google Analytics)
- Go to Tags and click New
- Click on the tag configuration area
- Select Google Analytics: GA4 Event
- Enter your GA4 Measurement ID
- Set Event Name to:
{{Event}}(this uses the event name from the dataLayer) - 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 page URL
- Click Connect
- Interact with your giveaway (login, enter, complete actions)
- In the Tag Assistant panel, you should see SweepWidget events (sw_page_view, sw_user_login, sw_contest_entry, etc.) appearing
- Click on each event to verify your tags are firing correctly
Publishing Your Container
Once you’ve confirmed everything is working 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
SweepWidget automatically pushes the following events to the GTM dataLayer:
Event List
| Event Name | When It Fires | What It Tracks |
|---|---|---|
| sw_page_view | User views giveaway page | Page loads and views |
| sw_user_login | User logs in to enter | User authentication |
| sw_contest_entry | User submits their entry | Contest entries |
| sw_insert_entry | User completes an entry method | Individual actions (like, follow, share, etc.) |
| sw_reload_widget | User refreshes the widget | Widget interactions |
dataLayer Structure
Each event includes the following data:
- event – Event name (with sw_ prefix)
- eventCategory – Category of the action (e.g., “Contest Entry”, “User Login”)
- eventAction – Action name (same as the event without prefix)
- eventLabel – Specific details about the action (e.g., “Facebook Like Page”, “Twitter Follow”)
Example dataLayer Push
When a user completes “Insert entry: Facebook Like Page”, the dataLayer receives:
{
event: "sw_insert_entry",
eventCategory: "Insert Entry",
eventAction: "Insert entry",
eventLabel: "Facebook Like Page"
}
Advanced Use Cases
Sending Events to Multiple Platforms
With GTM, you can send the same SweepWidget events to multiple analytics platforms simultaneously:
- Google Analytics 4
- Meta Pixel
- LinkedIn Insight Tag
- Hotjar
- Any custom tracking solution
Simply create multiple tags using the same SweepWidget trigger.
Creating Conversion Triggers
Set up specific triggers for important conversion events:
- Create a trigger for
sw_contest_entryto track contest completions - Create a trigger for
sw_user_loginto track user registrations - Use these triggers to fire conversion tags for Google Ads, Facebook Ads, etc.
Troubleshooting
Events Not Appearing in Preview Mode?
If you’re not seeing SweepWidget events in GTM Preview mode:
- Verify Container ID: Make sure you entered the correct GTM-XXXXXX ID in SweepWidget.
- Check browser console: Open your browser’s developer tools and look for any JavaScript errors that might be preventing the dataLayer from working.
- Refresh the page: After connecting Preview mode, refresh your giveaway page to ensure GTM loads properly.
- Check dataLayer: In the browser console, type
dataLayerand press Enter to see if events are being pushed (even if GTM isn’t recognizing them).
Tags Not Firing?
If events appear in the dataLayer but your tags aren’t firing:
- Check trigger configuration: Make sure you used
sw_.*with regex matching enabled for the event name. - Verify tag setup: Ensure your tag is properly configured and has the correct trigger attached.
- Check for conflicts: Some tag blockers or conflicting triggers might prevent tags from firing.
- Publish your container: Remember that Preview mode shows what WILL happen; you need to publish for changes to go live.
Best Practices
- Use consistent naming: When creating tags and triggers, use clear, descriptive names that indicate they’re for SweepWidget tracking.
- Create variables: Set up GTM variables for eventCategory, eventAction, and eventLabel to make tag configuration easier.
- Test before publishing: Always use Preview mode to verify your setup before publishing to production.
- Document your setup: Use GTM’s version descriptions to document what changes you make and why.
- Organize with folders: Group related tags, triggers, and variables into folders for easier management.
- Monitor performance: Regularly review your tag performance in GTM to ensure everything is working correctly.
Need Help?
If you need assistance setting up Google Tag Manager tracking for your giveaways:
- Contact SweepWidget support through the Contact Us page in your dashboard
- Visit Google’s GTM Quick Start Guide for help setting up your container
- Learn more about Google Tag Manager best practices