PUBLIC_API_TOKEN_HERE
(on Line 1) with your public API token. Please see bottom of page for instructions on retrieval.
Overview
ProfitWell Engagement needs you to add a bit of JavaScript to your application so that it can track when your customers log into your web-app. Support for mobile applications is coming soon.
Instructions for platform-specific instructions are below:
Web-App
If the user is logged in, make sure you pass the user's customer id to the snippet. Copy and paste the snippet below on your web app, making it available on as many pages of your site as possible (ideally, all of them).
<script id="profitwell-js" data-pw-auth="PUBLIC_API_TOKEN_HERE">
(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', { 'user_id': CUSTOMER_ID_HERE });
</script>
Update PUBLIC_API_TOKEN_HERE (on Line 1) with your public API token. Please see bottom of page for instructions on retrieval.
Remember to replace
PROVIDER_USER_ID_HERE
with the customer ID from your data provider (e.g. Stripe customer ID).- You can defer the call to
profitwell('start', { 'user_id': CUSTOMER_ID_HERE });
when the customer identity is loaded asynchronously.