How to Configure Facebook pixel and conversion API for CCPA Compliance on Shopify
Overview
To ensure compliance with the California Consumer Privacy Act (CCPA), the following steps outline how to set up an opt-out mechanism on your website. This implementation involves creating a CCPA form, managing cookies with Google Tag Manager (GTM), updating email variables, configuring Facebook pixel tags, and verifying Conversion API setup.
Steps to Enable CCPA:
If you want to enable CCPA then the approach is:
- Create an opt-out CCPA form on your website following CCPA guidelines
- Create HTML tag within GTM to set a cookie if someone submits the CCPA form
- Add a 1st party cookie variable to grab the cookie
- Update email variables to pass an empty string if the user submitted the CCPA form
- Update all Facebook tags initializing the pixel to pass the processing option parameters
- Confirm your Conversion API setup supports CCPA
How to Configure Facebook pixel and conversion API for CCPA Compliance on Shopify
Implement CCPA Form:
- You need a CCPA form on your website that users can submit their request of info not being used.
Here is [one example](. Note: there many variations of this implementation.
Create HTML Tag in GTM:
- Set up an HTML tag in GTM to set a cookie if someone submits the CCPA form opting out.
Add Variable to Grab Cookie:
- Create a 1st party cookie variable to grab the cookie set in the previous step.
- (See Figure 1)
Figure 1
Update Email Variables:
- Next, you will need to create another set of email variables that are the custom JS type that reference the dataLayer variable(s) used for email collection.
- You will also need to create email variables in GTM to be something like the following below to pass an empty string if they’ve opted out.
- So – if user opted-out then don’t include email. Otherwise include it.
function(){
var optedIn = {{CCPA Cookie}};
if (optedIn){
return '';
}
else {
return {{dlv - Global - User Email}};
}
}
- These variables then need to be swapped out in the tag(s) that you were previously sending an email dataLayer variable to.
Update Facebook Pixel to Pass the Processing Option Parameters:
- In all Facebook tags that initialize the pixel (the Sitewide and Purchase tags if you are using our templates), add the following lines before the init call:
if ({{CCPA Cookie}}){
fbq('dataProcessingOptions', ['LDU'], 0, 0);
}
else {
fbq('dataProcessingOptions', []);
}
- Here is an example of it implemented:
- Essentially we need to tell Facebook for the particular hit sent with their pixel if the data should be set up for limited use.
Confirm your Conversion API Setup Supports CCPA:
For the conversion API piece, you need to confirm two things:
- You are using our most up to date template for your server side GTM container (CCPA support was added 3/1/21). To confirm you have a template that supports CCPA, view the code of the "Facebook Server Side Events" template. You should see the following lines there:
- You are using "ccpaoptin" for your CCPA cookie in step two above.
Updated 3 months ago