All Collections
Author Help
Setting Up Google Analytics GA4 for Leanpub Books, Courses, and Bundles
Setting Up Google Analytics GA4 for Leanpub Books, Courses, and Bundles

Keywords: Google Analytics, GA4, how, setting up

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

In this article, we're going to show you how to set up a Leanpub book, course, or bundle to work with the new version of Google Analytics, GA4.

Please note that you need a Pro Author Membership to use our Google Analytics integration.

If you don't already have a Pro Membership, or to check which Membership you currently have, please go to your Membership page here:

To find out more about our different author Membership plans, please see this article:


A Brief Note: If you have any advice to add that could help improve this article and help other Leanpub authors, please post about it on the Authors Forum! One of our most popular posts on our old blog was from a Leanpub author who wrote a guest post about using Google Analytics. If you'd like to write a guest post yourself, please reach out to the team at hello@leanpub.com. Thanks in advance!


Next, sign in to Google Analytics: https://analytics.google.com/analytics/web

Make sure you've got the correct account selected (sometimes people have more than one GA account):

Click Admin at the bottom left:

Next, you need to create a unique "property".

Click + Create Property at the top-middle of page:

Enter a name for the new property. If the property is going to be used for one book, you may want to give the property the same name as the title of your book:

Scroll down and click Next:

Tick any of the boxes of information about your project that you want to share with Google. You do not have to select any of the boxes:

Scroll down and click Create:

Next, you need to set up a "data stream" in the property.

Under Choose a platform, select Web:

Under Website URL, enter Leanpub's address, leanpub.com:

Under Stream Name, enter a name for the data stream. Again, may want choose the same name as the title of your book:

Click Create stream:

At the top right of the page, copy the "Measurement ID". It will have G- followed by ten characters.

OK! You've got the GA4 "Measurement ID" that you need.

Next, go to the Analytics page for your book, course, or bundle, to enter the Measurement ID on Leanpub.

For a book, you can find the Analytics page at:

https://leanpub.com/YOUR_BOOK/analytics

...making sure to replace YOUR_BOOK with your book's unique web address.

For a course, you can find the Analytics page at:

https://leanpub.com/course_admin/leanpub/YOUR_COURSE/store/analytics

...making sure to replace YOUR_COURSE with your course's unique web address.

For a bundle, you can find the Analytics page at:

https://leanpub.com/b/YOUR_BUNDLE/store/analytics

...making sure to replace YOUR_BUNDLE with your bundle's unique web address.

You can access the Analytics page under "Store" on the overview page for any book, course, or bundle:

The page will look something like this:

Now, paste the Measurement ID from Google Analytics into the Google Analytics Code box:

(We've blurred out the ten-character code in this example.)

Next, click the blue button to update your book, course, or bundle:

That's it, you're all set up on Leanpub!

Regarding setting up and using Google Analytics itself, it is an amazing but somewhat complex product, and they have way more comprehensive and up-to-date help documentation than we can provide! Here is a link to Analytics Help:

We will, however, be releasing our own article about getting started using GA4 from a Leanpub author's perspective.

Finally, if you ever have questions about using Google Analytics as a Leanpub author, we recommend you go to our Authors Forum. You may find answers to your questions there, and you can post new questions if you can't find an existing comment thread with a solution.


[Note: This is not an endorsement, but you may find this video and the resources listed in the description to be a handy introduction to GA4 - Eds.]

Did this answer your question?