Google Tag Manager

You can easily integrate Pelcro with your Google Tag Manager in order to track and trigger certain events and hence tag sub-sequent steps there. Below are some examples of how to do this.

Integrate Google Tag Manager

The first step will be to integrate the general script tags that enable Google Tag Manager on your site. You can get these scripts from Google Tag Manager as well.

Head

<!--This is for <head>-->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-{INSERT ID HERE}');</script>
<!-- End Google Tag Manager -->

Body

<!--This is for <body>-->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NR2NDT7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Trigger events on Google Tag Manager based on Pelcro events

Tracking subscription conversions

Copy-paste the script below on your site and replace {INSERT ID} with "AW-CONVERSION_ID/AW-CONVERSION_LABEL" from your Google Tag Manager account.

<script>
  	// For subscription conversions 
    document.addEventListener("PelcroSubscriptionCreate", function (e) {
      
      //Trigger the value on 
      gtag('event', 'conversion', {'send_to': '{INSERT ID}',
        'value': e.detail.data.invoices[0].amount_paid/100,
        'currency': e.detail.data.invoices[0].currency
      });
    });

</script>