Learn how to integrate Oppla with Google Tag Manager
<script> (function(p,r,o,d,i,o){p[i]=p[i]||function(){(p[i].q=p[i].q||[]).push(arguments)}; o=r.createElement('script');o.async=1;o.src=d;r.head.appendChild(o); })(window,document,'script','https://cdn.oppla.app/tracker.js','oppla'); window.oppla.init('YOUR_PROJECT_ID'); </script>
// In GTM Custom HTML tag window.oppla.track('Page Viewed', { path: window.location.pathname, title: document.title, referrer: document.referrer });
// In GTM Custom HTML tag window.oppla.track('Button Clicked', { buttonId: '{{Click ID}}', buttonText: '{{Click Text}}', page: '{{Page Path}}' });
// In your website code window.dataLayer.push({ 'event': 'opplaEvent', 'eventName': 'Purchase Completed', 'eventProperties': { 'orderId': '12345', 'amount': 99.99 } });
// In GTM Custom HTML tag window.dataLayer.push = function(e) { if (e.event === 'opplaEvent') { window.oppla.track(e.eventName, e.eventProperties); } };
// In GTM Custom HTML tag window.oppla.identify({ userId: '{{User ID}}', traits: { name: '{{User Name}}', email: '{{User Email}}', plan: '{{User Plan}}' } });
Was this page helpful?