Skip to content

Instantly share code, notes, and snippets.

View capatina's full-sized avatar
🌴
On vacation

Sebastian capatina

🌴
On vacation
View GitHub Profile
@blanklob
blanklob / ga4-shopify-custom-pixel.js
Created July 1, 2023 23:40
Google Analytics 4 Shopify Custom Pixel
// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)
// Replace with you GA4 Tag
const TAG_ID = 'G-XXXXXXXXXX';
const script = document.createElement('script');
script.setAttribute('src', `https://www.googletagmanager.com/gtag/js?id=${TAG_ID}`);
script.setAttribute('async', '');
document.head.appendChild(script);
window.dataLayer = window.dataLayer || [];