Integrate Consent Mode on impact.com
Consent mode on impact.com is designed to adapt tracking behaviors based on the user's consent status, ensuring compliance with the ePrivacy Directive and similar regulations requiring user consent for cookies for tracking and analytics.
Note: For further information on Consent Mode and how it works, view Ensure GDPR Compliance using Consent Mode.
Implementation Overview
Prerequisites
- Access to your website’s Consent Management Platform (CMP)
- Basic familiarity with JavaScript
- impact.com account access
Detailed Implementation Steps
Step 1: Integrate the JavaScript Tag
- Obtain the UTT JavaScript code:
- Go to Settings → Tracking → General on your impact.com dashboard.
- Add the JavaScript tag to your site:
- Ensure the tag is placed correctly on every website page to function effectively.
- Initialize the consent command with a default status, which your CMP should set based on the user's consent and the legal requirements of their location.
Example
// If user consent is required:
ire('consent', 'default', {'tracking':'denied'});
// If user consent is not required:
ire('consent', 'default', {'tracking':'granted'});
Step 2: Update Consent Status Based on User Interaction
Dynamically update the consent state in response to user interactions with the consent banner:
Example
// User grants consent
ire('consent', 'update', {'tracking':'granted'});
// User denies consent
ire('consent', 'update', {'tracking':'denied'});
Step 3: Implement Conversion Tracking
Server-Side
If using our Conversions API to send conversions, please follow the below guidance to implement in consent mode:
- Include any relevant first-party identifiers. For example, if you specified
CustomProfileId
in the tag’sidentify
function call, we recommend sending theCustomProfileId
with the conversion event. - Use
generateClickId
to obtain an encoded first-party user identifier on your pages. Send this parameter along with the conversion event. - Send all conversion events for users referred by loyalty or rewards partners along with the relevant identifiers, even if the user didn’t provide consent. To identify such conversions, you can check for the presence of
impact-loyalty
localStorage object or manually store an identifier if the user’s initial navigation contains theim_rewards=1
flag in the landing page URL query string. - To accurately assess the impact of partner referrals in scenarios where user consent is not provided, it is crucial to send all conversion events. However, for conversions from non-consented users, ensure that personally identifiable information (PII) such as customer IDs, emails, and click IDs is excluded from the event data. This approach allows us to maintain privacy compliance while still gaining valuable insights into the effectiveness of partner referrals without user consent.
ire('generateClickId', function(click_id) {
console.log(click_id);
});
JavaScript
Our JavaScript tag’s conversion tracking is natively implemented with consent mode and respects the user's preference for setting cookies and sending identifiers.
Step 4: Activate Consent Mode
Collaborate with your impact.com implementation engineer to activate consent mode for your program.
Implementation Example
Identify Event
Important: Always invoke the consent command before the identify command to ensure the default settings are applied correctly. Incorrect order can lead to non-functional consent defaults.
To make an identify when the user hasn’t provided consent:
<script type="text/javascript"> (function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]=e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('https://utt.impactcdn.com/A2053126-5d01-4742-8b18-af317ea4ee6b65535.js','script','ire',document,window);
ire('consent', 'default', {'tracking':'denied'});
ire('identify', {customerId: 'Customer Id', customerEmail: 'SHA1 Email Address'});
</script>
On the same page, to update the consent status when the user provides consent:
ire('consent', 'update', {'tracking':'granted'});
Track Conversion Event
Send a conversion when the user hasn’t provided consent:
<script type="text/javascript">
(function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]=e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('https://utt.impactcdn.com/A2053126-5d01-4742-8b18-af317ea4ee6b65535.js','script','ire',document,window);
ire('consent', 'default', {'tracking':'denied'});
ire('trackConversion', actionTrackerId, {properties}, {options});
</script>
Send a conversion when consent is granted:
<script type="text/javascript">
(function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]=e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('https://utt.impactcdn.com/A2053126-5d01-4742-8b18-af317ea4ee6b65535.js','script','ire',document,window);
ire('consent', 'default', {'tracking':'granted'});
ire('trackConversion', actionTrackerId, {properties}, {options});
</script>
Detailed Tag Overview
The JavaScript tag implements the following behaviors when the consent function call is made on the page.
When consent is required:
- The UTT will queue events using the browser’s localStorage but not store tracking cookies or send tracking or user identity data to the server.
- The UTT will send a profiling event to the server that consent was requested from the user.
- If the
im_rewards
flag is set, we will place cookies and send the current event to the server, but no queued events.
ire('consent', 'default', {'tracking':'denied'}
User grants consent:
- Place tracking cookies.
- Send all queued events and user identity data to the server.
ire('consent', 'update', {'tracking':'granted'})
User denies consent:
- Send a profiling request with consentStatus: denied.
- Delete all queued data except for data related to loyalty/rewards events.
ire('consent', 'update', {'tracking':'denied'})
Updated about 2 months ago