Adding Vendor Tag to Page Based on Consent

This article provides instructions on adding a vendor's tag to a web page based on whether a user has consented or not.

Overview

Through the use of Sourcepoint's consent actions it is possible to add a vendor's <script> tag to a page based on whether a user has consented to a vendor or not.

Part 1 Adding A Tag Based on Consent

Below is a simple script that can be added to the consent action of a vendor in order to append the vendor's tag to the page based on the user's consent.

Step 1: Copy the snippet and swap out the vendor URL

In this example, you would replace http://ad.somevendor.net/site/c=14674/pe=y/?param=true with the URL for your particular vendor's tag.

function addVendor(url){
var s1 = document.createElement('script');
s1.type = 'text/javascript';
s1.src = url;
try {
document.body.appendChild(s1);
}
catch (e) {
console.error("SP: Couldn't append " + s1.src + "to page. Error: " + e)
}
}
addVendor("http://ad.somevendor.net/site/c=14674/pe=y/?param=true");

Then you would copy the updated snippet into the consent action for the vendor in the Sourcepoint user interface (see screenshot below).

Part 2 Adding an opt-out pixel (optional)

In some cases your vendor may ask for you to fire an opt-out pixel or opt-out tag for users that reject consent.

Step 1: Copy the snippet and replace the vendor's opt-out pixel URL

In this example, you would replace http://ad.somevendor.net/site/c=14674/pe=y/?optout=true with the URL for your particular vendor's tag.

var opt_out_pixel = new Image();
var opt_out_url = "http://ad.somevendor.net/site/c=14674/pe=y/?optout=true";
opt_out_pixel.src = var opt_out_url;

Step 2 Copy the updated snippet to the vendor's reject action

Then you would copy the updated snippet into the reject action for the vendor in the Sourcepoint user interface (see screenshot below).