Integrating Leaky Paywall with Google Analytics

There are many ways to integrate Leaky Paywall with Google Analytics. We'll start with event tracking. This assumes you using the new gtag syntax for your Google Analytics tracking code. 

1. Event: Subscribe nag display

Add this code into the "Subscribe or Login Message" setting under Leaky Paywall > Settings > General.

<script>gtag('event', 'view_item', { 'event_category': 'engagement', 'event_label': 'subscribe_nag', });</script> <br>

2. Event: Subscribe nag subscribe click

Add this code into the "Subscribe or Login Message" setting under Leaky Paywall > Settings > General.

<a onClick="gtag('event', 'click', { event_category: 'subscribe_nag', event_action: 'click', event_label: 'subscribe'});" href="{{SUBSCRIBE_URL}}">Subscribe</a><br> <br>

3. Add a Leaky Paywall transaction to the data layer

If you are using Google Tag Manager, you can use the following snippet to add Leaky Paywall transaction data to the data layer.