How to add Google Analytics to PayWhirl

You can enable the Google Analytics plugin from the "Apps & Integrations" menu item under "Settings & Account" in PayWhirl

Larry Brager avatar
Written by Larry Brager
Updated over a week ago

You can enable the Google Analytics app from the "Apps & Integrations" main menu item under Settings & Account in PayWhirl.

Next, click the "Install App" button next to the Google Analytics app:

You will need to locate your Google Analytics Tracking ID from your Google Analytics account. It appears in the format, UA-XXXXX-Y

Once you have found your GA tracking id number, you can fill out the required fields for in the Google Analytics app inside your PayWhirl account.

Once you save your settings within the PayWhirl app successful, a google analytics script will be automatically added to your account and you will begin to see data in your Google Analytics account when visitors are viewing your PayWhirl widgets, payment forms or customer portal.


Advanced Cross-Domain Tracking Instructions (optional)

For most users, the implementation above should be enough to suffice. It will track all of the pages your customers visit within your customer portal, widgets, and payment forms. However, it does not allow for cross-domain tracking from your parent domain, into the payment widget. It only tracks what happens inside our embedded iFrames.  

To enable cross-domain tracking from your parent domain to the PayWhirl widgets embedded into your website you'll need to make some edits to the google analytics script on your parent domain.

1) Add the following tracking script to all the pages you wish to track after you've filled out the missing parameters: 

UA-XXXXX-Y
YOUR-PARENT-DOMAIN
YOUR PAYWHIRL-SUBDOMAIN
(should be in format company-name.paywhirl.com)

<script type='text/javascript'>(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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto', {allowLinker: true});
ga('require', 'linker');
ga('linker:autoLink', ['YOUR-PARENT-DOMAIN', 'YOUR-PAYWHIRL-SUBDOMAIN']);
ga('send', 'pageview');

</script>

2) Test the checkout flow for any widgets you've created and watch "realtime" metrics in your Google Analytics account - it should display the URLs you visit in real time as you brows from page to page. Note: The accordion widget style urls are virtual (each accordion tab that displays triggers a page view in google analytics).

Related Articles:

Please let us know if you have any questions.

Sincerely,
The PayWhirl Team

Did this answer your question?