Introduction to Google Tag Manager (GTM) for Conversion Tracking in PropellerAds
![Propellerads-google-tag-manager-tracking](https://static.propellerads.com/blog/wp-content/uploads/2024/08/Propellerads-google-tag-manager-tracking.png)
This post is also available in:
PT
ES
Did you know that you can use Google Tag Manager (GTM) as an alternative conversion tracking tool for PropellerAds users? Well, today, we’re talking about this approach!
Conversion tracking is something you should never ignore, if you want to make sense of your campaign performance and see how to optimize things effectively. In this respect, GTM works great for direct advertisers, who don’t have too much experience with trackers.
We explain the entire process in detail, but give you a code that would help you set everything up in no time, but you will have to set up the GTM triggers properly on your side to get conversions fired at the desired events. Please mind that this might be a bit tricky for newbies.
Also, please mind that the script needs some time to load, so ideally the page should be static.
Disclaimer: The code below was written by one of our partners and was successfully tested with several advertisers. However, we do not provide support or assistance for this code since it doesn’t belong to us.
Also, we can’t guarantee tracking accuracy for all advertisers as every case is unique. Ask your personal manager if you have issues with the code.
Ready? Let’s dive in!
What is Google Tag Manager?
So, what exactly is Google Tag Manager?
Simply put, it’s a free tool from Google that helps you manage and deploy various marketing tags (small pieces of code) on your website or app without needing to dive really deep into the code every time.
This means you can track conversions, gather analytics, and more, all without getting too technical.
What is a Tag?
And what’s a tag?
In GTM, a tag is a snippet of code added to your site to collect data. Think of it as a way to track what’s happening on your site, like page views, clicks, or form submissions.
Benefits of Using GTM
Why should you consider using GTM? Here are some great reasons:
- Quick and Easy
You can add and update tags by yourself, no need to call in the developers every time you need a change. This saves time and keeps things moving smoothly. - Error-proof
GTM comes with built-in features to check that your tags are working properly before they go live. This way, you can catch any mistakes early on. - Agency-friendly
Agencies can add tags while clients review and approve the changes. It’s a great way to keep everyone on the same page. - Version Control
You can easily manage and switch between different versions of your tags. If something goes wrong, you can quickly revert to an earlier version. - Event Tracking
GTM lets you track specific events like button clicks or form submissions without needing to code them manually. This makes it simpler to gather detailed data about how users interact with your site. - Flexible Tag Firing
You can set rules for when tags should trigger, giving you control over what data is collected and when. - Mobile-friendly
GTM supports tracking on mobile websites and apps, ensuring you capture data across all devices.
Who Might Find GTM Useful?
Pretty much any PropellerAds partner, looking to simplify their tracking process can benefit from using GTM.
If you’re an advertiser wanting to get a better handle on user behavior and optimize your campaigns, GTM is for you. It’s especially useful if you’re already familiar with Google’s tools.
Here’s a closer look at who might find GTM especially useful:
- Advertisers and Marketers
If you’re running multiple campaigns and need to keep track of various user interactions, GTM can make your life a lot easier. It helps you see what’s working and where you can improve without having to dig into the code every time. - Small Business Owners
You might not have a dedicated tech team, but with GTM, you can still manage your tracking needs efficiently. It’s user-friendly and doesn’t require a deep technical background. - Agencies
If you’re managing multiple clients, GTM allows you to add and update tags quickly, keeping your clients informed and ensuring transparency. - Developers
While GTM is designed to minimize the need for constant coding, developers can still benefit from its advanced features, making it easier to implement and test tracking without disrupting the main codebase.
Installation Guide for GTM
Ready to get started with Google Tag Manager? Here’s a simple guide to help you set it up:
- Create a GTM Account:
- Go to the Google Tag Manager website.
- Click on “Start for free” and sign in with your Google account.
- Create a new account by entering your account name and setting up a container (which can be your website or app).
- Install GTM on Your Website:
- Once your container is created, GTM will provide you with two snippets of code.
- Copy and paste the first code snippet as high in the <head> of the page as possible.
- Paste the second code snippet immediately after the opening <body> tag.
- Save your changes and publish your container.}
- Verify Installation:
- Use the GTM preview mode to ensure the code is working correctly.
- In GTM, click on “Preview,” enter your website URL, and then click “Connect.”
- Your website will open in a new tab with a debug panel at the bottom showing which tags are firing.
Step-by-Step Guide to Setting Up Custom HTML Tags
Please mind that the code below was written specifically for PropellerAds users and works only for them.
Now that you’ve got GTM installed, let’s walk through setting up some custom HTML tags. These tags will help you track specific events and conversions in your PropellerAds campaigns.
Create a New Custom HTML Tag:
- In your GTM dashboard, click on “Tags” and then “New.”
- Name your tag something like “Propeller Visitor ID.”
- Click on “Tag Configuration” and select “Custom HTML.”
Add the Script
Copy and paste the following script into the HTML field:
<script>
var value = new URL(location.href).searchParams.get("utm_prid");
if (value) {
var date = new Date();
date.setTime(date.getTime() + (30*24*60*60*1000));
document.cookie = "prop_visitor_id=" + (value || "") + "; expires=" + date.toUTCString() + "; path=/";
}
</script>
Set the Trigger
- Click on “Triggering” and choose “All Pages.”
- Save the tag and publish your changes.
This script retrieves the “utm_prid” parameter from the URL and stores it in a cookie named “prop_visitor_id” with a 30-day expiration.
Custom HTML Tag for Registration Event
- Create Another Custom HTML Tag:
- Name this tag something like “Registration Event.”
- Select “Custom HTML” in the tag configuration.
- Add the Script:
Use this script to retrieve the visitor ID from the cookie and send it back to PropellerAds:
<script>
var visitorId = ('; ' + document.cookie).split('; prop_visitor_id=').pop().split(';')[0];
if (visitorId) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://ad.propellerads.com/conversion.php?aid=xxxxxxx&pid=&tid=132572&visitor_id=' + encodeURIComponent(visitorId), true);
xhr.send();
}
</script>
Please mind: The address ‘https://ad.propellerads.com/conversion.php?aid=xxxxxxx&pid=&tid=132572&visitor_id=’ is an S2S Postback URL that can be retrieved from your account’s Tracking section.
- Set the Trigger:
- Choose the appropriate trigger for the registration event (e.g., form submission or button click).
- Save and publish your tag.
Custom HTML Tag for First Deposit Event
- Create a Third Custom HTML Tag:
- Name this tag “First Deposit Event.”
- Select “Custom HTML” in the tag configuration.
- Add the Script:
Use this script to track the first deposit event:
<script>
var visitorId = ('; ' + document.cookie).split('; prop_visitor_id=').pop().split(';')[0];
if (visitorId) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://ad.propellerads.com/conversion.php?aid=xxxxxxx&pid=&tid=132572&goal=2&visitor_id=' + encodeURIComponent(visitorId), true);
xhr.send();
}
</script>
Please mind: The address ‘https://ad.propellerads.com/conversion.php?aid=xxxxxxx&pid=&tid=132572&visitor_id=’ is an S2S Postback URL that can be retrieved from your account’s Tracking section.
- Set the Trigger:
- Choose the appropriate trigger for the first deposit event.
- Save and publish your tag.
Target URL Format
Ensure your campaign target URL includes the “utm_prid” parameter like this: https://site.domain/?utm_prid=${SUBID}
Please mind: the domain above should be identical to the final event domain.
Testing
After setting everything up, it’s crucial to test your implementation. Share your target URL, and a test link will be generated to verify that everything is working as expected.
Bringing It All Together
You’ll find tracking and optimizing your PropellerAds’ campaigns much easier once you’ve set everything up in Google Tag Manager.
And yes, if GTM and all of those code seems too complicated to you, rely on PropellerAds inner S2S Tracker. Video guide for you:
Whether you’re new to tracking or looking for a more efficient solution, rely on tools you need to understand user behavior and enhance your marketing efforts. Happy tracking!
Want to discuss tracking with fellow-affiliates? Join our Telegram chat and make yourself comfortable!