How do I add Facebook Pixel and Google Analytics to my giveaway?
Quick answer
Giveaway Ninja runs two optional custom scripts: an On Load Script when the campaign appears, and a Conversion Script right after someone signs up. Add a Meta Pixel or Google Analytics event to either, such as fbq('trackCustom', 'JoinGiveawayMarch'). The Meta Pixel and Google Analytics tags must already be installed on the page.
Getting started
Giveaway Ninja lets you run two custom scripts when these events happen:
- On Load Script: fires when the campaign appears on screen
- Conversion Script: fires right after sign-up
These scripts are useful for sending events to Facebook and Google Analytics. For example, you can track an event on Facebook to retarget users who joined a specific giveaway.
To add them, edit your campaign, open the GIVEAWAY tab, scroll to the bottom and expand the Tracking Scripts section. It holds both fields: On Load Scripts (fired when Giveaway loads) and Conversion Scripts (fired after sign-up).
Tracking scripts are optional. They're only worth setting up if you run a structured marketing funnel.
Important: if you want to track events on Facebook or Google Analytics, make sure the Meta Pixel and Google Analytics tags are installed on the page. You most likely set them up when you launched your shop.
Use cases
Conversion Script and Facebook
The Conversion Script fires when a user joins the giveaway by entering their email or clicking the "Login with Facebook" button.
For example, this script tracks a "JoinGiveawayMarch" event:
fbq('trackCustom', 'JoinGiveawayMarch')Once tracked, you can use the event in many ways on Facebook: Meta's conversion tracking guide.
If you're running ads to promote your giveaway, the event can track the conversion that tells you how the ads are performing.
Testing
Once you've set up the giveaway, check the event is tracked correctly:
- Enter the giveaway with different emails to simulate new sign-ups
- Check Facebook Events Manager to make sure it's collecting data
Please note: Events Manager doesn't update instantly. New events can take a few minutes, or up to an hour, to show up.
The browser console is very useful for checking whether the scripts fire and send data to your tracking service (Meta Pixel or Analytics). It takes some technical skill, though. Just reach out to our support and we'll double-check the tracking.
Other examples
Example 1: track the pop-up in Google Analytics 4
<script>
gtag('event', 'view_promotion', {promotion_name: 'giveaway-popup'});
</script>Example 2: track sign-ups in Google Analytics 4
gtag('event', 'sign_up', {
method: 'Giveaway',
event_label: 'Giveaway Sign-up'
});Example 3: track a registration event on Facebook
<script>
fbq("track", "CompleteRegistration", {content_name: "giveaway-campaign-xmas"});
</script>Reference
Google Analytics for developers: https://developers.google.com/analytics/devguides/collection/ga4
To measure revenue rather than sign-ups, see how Giveaway Ninja tracks sales from a giveaway.
People also ask
How do I track giveaway sign-ups as a GA4 conversion?
Add a gtag('event', 'sign_up', ...) call to the Conversion Script, then mark the event as a key event in GA4. See how to set up a conversion script.
Can I retarget giveaway entrants on Facebook?
Yes. Fire a custom Meta Pixel event from the Conversion Script, then build a custom audience from it. Get more ways to drive traffic to your giveaway.
Why don't I see events in Facebook Events Manager yet?
New events can take from a few minutes to an hour to show up. Test with a few new sign-ups and check the browser console. See how to set up a conversion script.
Can I track revenue from a giveaway, not just sign-ups?
Yes. Giveaway Ninja attributes Shopify orders to your giveaway automatically. See how Giveaway Ninja tracks sales from a giveaway.
Still stuck?
Our support team is available 24/7 and always replies. Send us a message and we'll help you sort it out.