WebinarUnlocking growth outside the US - 24 July   Join us
How to install the Profitwell snippet using Google Tag Manager with two containers

Overview

For this installation path, we expect you to have two different Google Tag Manager containers: one for your marketing site, and another one for your web-app site.

  • Marketing sites: users can't sign in to these sites, e.g. landing pages, marketing sites, promotional pages.
  • Web-Apps: users can sign into them, although they may also be able to visit these sites anonymously, without an account.
    If you only have one container, you should check these instructions.
    Below, the instructions for every container:

    Marketing Site

  1. Open the corresponding GTM container, click on New Tag and write a meaningful name, like ProfitWell Snippet.
  2. On Tag Configuration, click on Custom HTML.
  3. Paste the Marketing Site snippet, replacing PUBLIC_API_TOKEN_HERE with your public API token:
    <script id="profitwell-js" data-pw-auth="PUBLIC_API_TOKEN_HERE">
        /* DO NOT DELETE - this code is used to accept our payments or send data to ProfitWell*/
        (function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};
        a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+
        s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);
        })(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');
    
        profitwell('start', {}); 
    </script>
  4. Check Support document.write below the HTML snippet.
  5. On Triggering, select All Pages.
  6. Save the tag and Submit the changes.

Web-App

It is recommended to first load the snippet and then, once your app knows exactly whether there is a logged-in customer or not, start it. Start by going to your Web-app container.

Load the snippet

  1. Click on New Tag and write a meaningful name, like ProfitWell Snippet Load.
  2. On Tag Configuration, click on Custom HTML.
  3. Paste the Web-App Load Snippet, replacing PUBLIC_API_TOKEN_HERE with your public API token.
    <script id="profitwell-js" data-pw-auth="PUBLIC_API_TOKEN_HERE">
        /* DO NOT DELETE - this code is used to accept our payments or send data to ProfitWell*/
        (function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};
        a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+
        s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);
        })(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');
    </script>
  4. Check Support document.write below the HTML snippet.
  5. On Triggering, select All Pages.
  6. Save the tag.

Start the snippet

From within your page, you have to tell Google Tag Manager's Data Layer whether there is a logged-in customer or not, in other words, if you are in your Marketing site or your Web-app site.

  1. If there is a logged-in customer:
    dataLayer.push({ 'event': 'start_pw', 'pw_user_email': user_email })
  2. If you are sure that the customer is anonymous:
    dataLayer.push({ 'event': 'start_pw' })
    For more information on the Data Layer, visit the Google Tag Manager Developer Guide.

Then, on the corresponding Google Tag Manager container (Web-app), ensure that the pw_user_email variable is defined:

  1. Go to Variables and under User-Defined Variables, click on New and write pw_user_email as the name.
  2. On Variable Configuration, select Data Layer Variable.
  3. Write pw_user_email as the Data Layer Variable Name and click on Save.

After that, add the PW Start tag and publish:

  1. Click on New Tag and write a meaningful name, like ProfitWell Snippet Start.
  2. On Tag Configuration, click on Custom HTML.
  3. Paste the Web-App Start Snippet.
    <script>
        profitwell('start', { 
            'user_email': {{pw_user_email}}
        });  
    </script>
    Do not worry about anonymous customers, the above snippet will work for them, and also for those that are logged-in.
  4. On Triggering, click on + (New Trigger) and write a meaningful name, like Start PW.
  5. On Trigger Configuration, click on Custom Event.
  6. In Event name, write start_pw (or whatever event name you pushed to the Data Layer).
  7. Save the trigger, Save the tag and Submit all the changes.


Need more help?

Login to your Paddle account to chat directly with our Seller Support Team or…