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.
(If you are on a Free or Standard plan, and you'd like to upgrade to Pro so you can use GA4, please go to your subscriptions page here.)
(Oh, and if you need to switch from the old UA or "Universal Analytics" to GA4, please see this article instead.)
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 firstname.lastname@example.org. Thanks in advance!
First, create a Leanpub book or course.
Next, go to Google Analytics.
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:
...making sure to replace YOUR_BOOK with your book's unique web address.
For a course, you can find the Analytics page at:
...making sure to replace YOUR_COURSE with your course's unique web address.
For a bundle, you can find the Analytics page at:
...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.]