Skip to main content

Google GTM - control your Extra vendors finely

At Sfbx, vendors or partners are split into two buckets : The IAB and non-IAB Vendors.Non-IAB vendors are what we call Extra vendors


STEP 1: Adding snipet of code to control finaly Extra vendors

Two options:

Option 1: In the <head> section of your website.

Option 2: In the initiatization Custom HTML tag in your GTM

Add this piece of code :

<script>
__tcfapi('addEventListener', 2, function (tcData, success) {
if (success && tcData.gdprApplies && (tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete')) {
if(tcData.purpose.consents[1]) {
for (var c in tcData.acExtraVendors) {
window.dataLayer.push({ event: 'acextravendor_granted_' + tcData.acExtraVendors[c] })
}
// Removing listener
// __tcfapi('removeEventListener', 2, function(){}, tcData.listenerId);
}
}
}
)
</script>

This code will throw events to your GTM according to the Extra vendors that have been granted by the user.

info

The events will be fired only if the Purpose 1 is True.

Once this code is live, you will get this kind of events sent into the GTM dataLayer

Google Tag Manager

STEP 2: Connecting the dots

Let's say that you want to fire your ACME Pixel Tag only if the vendor ACME is granted.

( We assume that the ACME Extra vendors is already created in your Backoffice and linked to the source of your notice.

Tip : If the vendor is correctly linked, you will see the Extra Vendor ACME in the "Other Partners" section in your CMP, when you click on partners link of the first or second layer.

  • Go to your backoffice, click on Extra vendors item in the left menu

Click on the copy icon - it will automaticaly copy the alphanumerical ID of the vendor ( first item on the left ) - in our case, it's j6cj1jj2

  • Create a custom event in the GTM console.

Google Tag Manager

The value of the custom events must end with the right ID of the extra vendor you want to control.

Now, you just have to use this trigger in order to link the ACME Tag to this Trigger.

Google Tag Manager

That's it. Now your ACME Tag will be fired only if :

  • The purpose 1 is granted - Read & Write ID/cookies on the user's device.

  • The Extra-vendor is granted by the user.

Have a suggestion ? Just drop an email to support@sfbx.io