TLDR: Snapchat Pixel requires consent for EU users. GetCookies blocks it until marketing consent using a simple data attribute. Essential for Gen Z advertising.
Read full summary
Snapchat advertising reaches younger demographics that other platforms miss. The Snap Pixel requires proper consent handling in the EU. This guide shows how to implement it correctly.
*Summary by Claude AI*
## Reaching Gen Z? You Need Compliant Tracking
Snapchat is where Gen Z lives. If your audience skews young, Snapchat ads are essential.
But like every other platform, Snap Pixel requires consent in the EU. Fire it without permission, and you're breaking the law.
## The GetCookies Implementation
```html
```
The `type="text/plain"` blocks execution. GetCookies activates it after marketing consent.
## Event Tracking
After consent:
```javascript
// Page view
snaptr('track', 'PAGE_VIEW');
// Purchase
snaptr('track', 'PURCHASE', {
'currency': 'USD',
'price': 99.99,
'transaction_id': 'order_123'
});
// Add to cart
snaptr('track', 'ADD_CART', {
'currency': 'USD',
'price': 29.99,
'item_ids': ['SKU123']
});
// Sign up
snaptr('track', 'SIGN_UP');
// Custom event
snaptr('track', 'CUSTOM_EVENT_1');
```
## Dynamic Loading Pattern
```javascript
window.addEventListener('getcookies:consent', (e) => {
if (e.detail.marketing && !window.snapLoaded) {
loadSnapPixel();
window.snapLoaded = true;
}
});
function loadSnapPixel() {
(function(e,t,n){
if(e.snaptr)return;
var a=e.snaptr=function(){
a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)
};
a.queue=[];
var s='script';var r=t.createElement(s);r.async=!0;
r.src=n;var u=t.getElementsByTagName(s)[0];
u.parentNode.insertBefore(r,u);
})(window,document,'https://sc-static.net/scevent.min.js');
snaptr('init', 'YOUR_PIXEL_ID');
snaptr('track', 'PAGE_VIEW');
}
```
## Snapchat Conversions API (Server-Side)
For better attribution:
```python
import requests
import hashlib
url = "https://tr.snapchat.com/v2/conversion"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
payload = {
"pixel_id": "YOUR_PIXEL_ID",
"timestamp": "1640000000000",
"event_type": "PURCHASE",
"event_conversion_type": "WEB",
"hashed_email": hashlib.sha256("
[email protected]".encode()).hexdigest(),
"price": 99.99,
"currency": "USD"
}
response = requests.post(url, headers=headers, json=payload)
```
## Testing
1. Use Snap Pixel Helper extension
2. Load site in incognito
3. Verify pixel doesn't fire before consent
4. Accept marketing cookies, verify events fire
## The Bottom Line
Snapchat Pixel needs consent. GetCookies makes it trivial:
1. Add `data-cookieconsent="marketing"`
2. Set `type="text/plain"`
3. Pixel only loads after consent
Reach Gen Z. Stay compliant.
---
**Ready to make your Snapchat Pixel compliant?**
[Set up GetCookies in 5 minutes](https://getcookies.co)