Integrate with Google Analytics

You can integrate Google Analytics 4 (GA4) with Memberful to track conversions that happen in Memberful. When someone completes a checkout through Memberful, we send an ecommerce event to Google Analytics.

In this help doc:

Add the Memberful domain in your GA4 settings

Follow Google’s documentation to set up cross-domain measurement. Under Domain add memberful.com.

Configure cross-domain measurement

Create a data stream to receive a Measurement ID

From your GA account, click Admin (the gear icon in the bottom-left corner of the page).

GA Admin gear button

Select your desired property. (Default will work.)

Select property

Next, click Data Streams either on the sidebar or the main panel.

Click Data Streams

From there you can either add a new stream or select an existing one.

Add or select data stream

If you decide to add a new stream, choose Web for data collection.

Web data collection

To finish creating a new stream, enter your website's URL and a name for your stream, enable enhanced measurement (optional but recommended), and click Create stream.

Website URL and name

Copy your measurement ID

After creating or opening a data stream, you'll see your measurement ID, which looks like this: G-XXXXXXXXXX. Keep it handy as you'll need it for the following steps.

Measurement ID

Install Google's tracking script on your site

You'll need to install Google's tracking script on your website to detect when visitors click a Memberful purchase link, which instructs Memberful to track any conversions that result from their checkout process in Google Analytics. There are a few ways to do this.

If your site is built on WordPress, the easiest method will be to use Google's official WordPress plugin. For non-WordPress sites, you’ll have 2 options: Use Google Tag Manager, or insert Google's "gtag" script directly into your website's code.

WordPress plugin

WordPress sites can take advantage of Google's official WordPress plugin, which simplifies the process of adding Google Analytics to your site.

  1. Install and activate the GA Google Analytics plugin on your WordPress site.
  2. Visit Settings → Google Analytics → Plugin Settings.
  3. Enter your GA Tracking ID.
  4. Choose Google Tag.
  5. Click Save changes.

GA Google Analytics plugin settings

The last step is to activate Memberful's Google Analytics integration.

Google Tag Manager

For non-WordPress sites, Google Tag Manager (commonly referred to as GTM) is a great way to insert Google's tracking script, as well as any other tracking scripts you might need. Once installed, it allows you to manage all your tracking scripts without having to edit your site's code.

To get started with Google Tag Manager, visit https://tagmanager.google.com/ and create an account and container.

You'll be provided with a couple of code snippets to insert into your site's code. The advantage of GTM is that this will be the only time you'll need to edit your site's code. After that, you can add and manage all your tracking scripts from the GTM dashboard.

GTM snippets

Use the Test your website feature on that screen to ensure that the GTM container is correctly installed on your site.

Once you've inserted the code snippets into your site's code, you're ready to create a new tag for Google Analytics. Match the settings in the screenshot below, replacing the measurement ID with the one you copied earlier.

GTM tag configuration for Google Analytics

Remember to submit/publish your changes in GTM after creating the tag or making any updates. Otherwise, they won't be applied to your site.

Publish GTM updates

The last step is to activate Memberful's Google Analytics integration.

gtag.js

The other option for non-WordPress sites is to insert Google's "gtag" script directly into your website's code. This method is a bit more advanced and requires you to have access to your site's code.

Follow the steps in Google's documentation to install the gtag.js script on your site. It will look something like this:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'TAG_ID');
</script>

This is just a sample. You should follow the link above to get Google's up-to-date code. Remember to replace TAG_ID with your Measurement ID from earlier.

For more details, refer to the gtag.js documentation.

The last step is to activate Memberful's Google Analytics integration.

Test Google Analytics

After you’ve enabled cross-domain measurement using one of the above methods, you'll be ready to test whether the tracking is working.

For this test, we'll need to open a plan purchase link while ensuring that it won't appear in an overlay. To do this, visit your site, right-click on a plan purchase link, and choose Open Link in New Tab (This option might be labeled a bit differently in your browser).

Open link in new tab

If the URL in the address bar contains _gl=..., then the tracking is working:

GL parameter in URL

Configure Memberful’s Google Analytics integration

Navigate to Settings → Third-Party Services from your Memberful dashboard, and activate the Google Analytics integration. You'll need to input the Measurement ID you found earlier.

Configure Google Analytics integration

Monitor Memberful conversions in Google Analytics

You're done! Once you leave test mode by connecting to Stripe, Memberful will track all new purchases in Google Analytics. Conversion events won't be sent to Google Analytics while in test mode.

Memberful conversions will show up in Google Analytics under the Conversions → Ecommerce section after 24-48 hours, so you may need to wait a bit in order to be able to see that data.

Ecommerce purchase events

However, there's a way to quickly test that the integration is working. You can do this by placing a test purchase (which can be made using a 100% discount coupon) and checking if the conversion shows up as a purchase event in the Realtime section.

Purchase event in Realtime view

Keep in mind that Google Analytics events can be blocked by certain privacy-focused browsers (like Safari and Firefox), incognito windows, or ad-blocker plugins.

If you'd like to reduce the likelihood of conversions being blocked, you can optionally use server-side tagging to send data directly from your server to Google Analytics.

Track Google Ads

Once set up, you can measure which orders are attributable to your Google Ads, as well as the monetary value of those orders. Google Ads is another sales channel that will show up in Google Analytics. After setting up your Google Ad campaign, the Google Ads data is typically pulled right into Google Analytics.

If you want to attribute order amount to those Google Ads, you'll need to make sure the Google Analytics-Memberful integration is configured and that you create events to assign attribution.

Track logged-in members

Memberful does not track log-in activity as we don't store any login-related data in our database.

You could track logged-in members by using a WordPress site with the wp_login action. This would require the following:

(Optional) Implement server-side tagging

If you'd like to reduce the likelihood of conversions being blocked by privacy-focused browsers or ad-blocker plugins, you can use server-side tagging. This method sends data directly from your server to Google Analytics, bypassing the user's browser.

Memberful does not host the tagging servers, so you'll need to set up your own tagging server container.

As you set up the client configuration in Google Tag Manager, you'll need to enable "Default gtag.js paths for specific IDs".

Default gtag paths for specific IDs

Once you've configured your tagging server, navigate to Settings → Third-Party Services → Google Analytics → Settings from your Memberful dashboard and enter your server's URL in the Server URL field.

Server-side tagging

This will allow Memberful to send data to your server, which will then forward it to Google Analytics, bypassing the user's browser and reducing the likelihood of conversions being blocked.

Related help docs:

Can't find what you're looking for? We'd love to help! 💪

Send us a message through the orange chat bubble in the lower right corner of the page. You'll hear back within a few hours Monday - Friday. 😀