Skip to main content
Setup PPC Tracking using Google Tag Manager
Updated over a week ago

In this guide, you will learn how to configure PPC tracking in Affelios using Google Tag Manager (GTM). Pay-per-click (PPC) tracking is a critical aspect of digital marketing strategies that focus on paid advertising campaigns, by integrating Affelios with GTM, marketers can seamlessly track affiliate conversions, attribute them to specific PPC campaigns, and optimize their overall marketing strategy.

The importance of PPC tracking can be understood through several key points:

  1. Performance Measurement: It allows for the real-time tracking of metrics like clicks, impressions, and conversions, crucial for assessing the return on investment (ROI).

  2. Campaign Optimization: Insights from tracking enable advertisers to optimize ads, keywords, and budgets for better performance.

  3. Budget Efficiency: Effective tracking helps allocate budgets more efficiently, directing resources to high-performing ads and reducing spend on underperformers.

  4. Audience Insights: It provides valuable data on audience behavior, helping tailor future campaigns to meet target preferences.

  5. Competitive Edge: Continuous optimization based on tracking data can provide a competitive advantage in the marketplace.

  6. Keyword and Content Insights: Understanding which keywords and ad content drive conversions informs strategy refinement.

  7. ROI and Profitability: By comparing ad costs against revenue from conversions, PPC tracking ensures campaigns contribute positively to financial goals.

Configuring Google Tag Manager

This guide assumes that Google Tag Manager has already been integrated with your site. To start tracking PPC with Google Tag Manager, you'll first need to create a new tag, so begin by clicking "Add a new Tag" from the Tag Manager dashboard.

You'll want to first give your new tag a name, we've decided to name it "Affelios Tracker" in this example. The next step is to click on the Tag Configuration box, at which point you will be presented with an option menu on the right hand side of the screen, from here you'll want to select "Custom HTML Tag."

With this next step, you're going to need to copy + paste our code snippet for tracking PPC. Within this code snippet, you'll need to change a few of the configuration parameters to suit your needs.

<script>
(function(d,s){
window.Affelios = {
Tracker: {
operatorId: '',
brandId: '',
defaultTrackerId: '',
productId: '',
mediaId: '',
clickKeyQueryParameter: 'gclid',
keywordQueryParameter: 'keyword',
trackerIdQueryParameter: 'trackerId',
productIdQueryParameter: 'productId',
mediaIdQueryParameter: 'mediaId',
// organicTracking: false,
// organicTracking: {
// organicTrackerId: '',
// }
}
};
var e = d.createElement(s),
m = d.getElementsByTagName(s)[0];
e.async = 1;
e.src = "https://js.affelios.com/platform-connect/platform-connect.0.0.0-alpha.5.js";
m.parentNode.insertBefore(e,m);
})(document,'script');
</script>

The majority of these parameters have pre-configured defaults, and only 3 are required. The required parameters are your operator ID, your brand ID, and the ID for a default fall-back tracker. A fall-back tracker is used when no tracker ID is passed to the PPC tracker via the click URLs setup in Google ads and such. To read more on this, continue onto the "Configuring the Tracking URLs" section below.

Once you've finished, the next step is to select a trigger. This trigger will tell Google Tag Manager when to trigger the script above, the recommended approach is to select the "All Pages" trigger.

After completing the steps above, click the "Save" button to the top right of the page to save your new Tag.

Reminder: You'll need to submit and publish your new Tag for any of the changes to take effect.

That's it, you're done configuring Google Tag Manager, the next step is to ensure that the tracking URLs are setup correctly.

Configuring the Tracking URLs

There will be different ways to set and configure your URLs depending on what platform you are using, but for popular platforms like Google Ads, you will be given the option to include keywords and the Google Click ID (gclid) into your URL. For the script above to start tracking Pay-Per-Click, you'll need to include the keyword and gclid into your URL as well as an "affeliosTrack" parameter with the value "true."

You can optionally pass in other parameters such as which trackerId to use, this will override the configured default and instead will attribute clicks to a specific tracker in Affelios.

For more information on which parameters can be passed through, please see our documentation on our npm package.

Did this answer your question?