Google Analytics

To connect to your Google Analytics account, go to the ReCharge Dashboard and into your Settings menu and select Integrations.

You will be setting up the funnel in Google Analytics. Be sure to set the destination to Regular Expression since this will be cross-domain. When it goes from /cart to /r/checkout is when it switches from the Shopify domain to the Recharge checkout domain .

Be sure to add the following code only to the Thank You page for the goals mentioned in this guide to function properly: 

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

Debugging

If you're having trouble seeing the Google Analytics, consider the following:

  • Has the Google Analytics ID been added in the Settings > Integrations section and is it set to the correct Universal vs Legacy type?
  • Is the checkout URL showing the ga linker parameters? It should look like &_ga=1 . 235381761.1020253843.1454177660 and appears near the end of the URL.
  • Is it is showing traffic to the checkout pages, but just not the eCommerce conversion tracking? Or is it not showing any traffic at all?
  • Is the GA information not passing for all orders, or only some of them?

Note: Recurring subscription transactions do not take place on a browser, instead it is in the background on a server, so we cannot send that info into Google Analytics.

If you're using Google Analytics and notice that the source is not tracking across the domains, it's likely you have an older version of the ReCharge code and need a quick update.

On subscription-cart-footer.liquid around line 41 find:

checkout_url= "https://checkout.rechargeapps.com/r/checkout?myshopify_domain="+myshopify_domain+"&cart_token="+token<br>

Replace with:

try { var ga_linker = ga.getAll()[0].get('linkerParam') } catch(err) { var ga_linker ='' } checkout_url= "https://checkout.rechargeapps.com/r/checkout?myshopify_domain="+myshopify_domain+"&cart_token="+token+"&"+ga_linker;

Feel free to contact us if you need assistance with this.

Please note that the ReCharge team can only offer limited assistance, as we are not Google Analytics experts. ReCharge merely fires the code as requested.

Still stuck? How can we help? Still stuck? How can we help?