Google recently released a huge update to Google Analytics called GA4, which is meant to replace the old UA or "Universal Analytics".
If you are already using Google Analytics for your Leanpub books, bundles, or courses, you will want to update all of them with a G4 code, to replace your old UA code on Leanpub.
You should retain your old UA data in Google Analytics, but after you complete this process, you will have a new G4 "data stream".
(If you want to set up GA 4 from scratch, 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 email@example.com. Thanks in advance!
First, go to Google Analytics.
Make sure you've got the correct account selected (sometimes people have more than one GA account).
Select the "property" associated with your book, bundle, or course.
Select Admin at the bottom left.
Select the GA4 Setup Assistant at the top-middle of the page.
Under Select I want to create a new Google Analytics 4 property, click on Get Started.
Click Create property.
Click on See your GA4 property.
You will now be taken to a "Setup Assistant" page.
Click Data Streams in the menu on the left.
At the top right of the page, click the little grey triangle pointing to right (it's under "Add stream") for the data 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:
(We've blurred out the ten-character code in this example.)
Next, delete the existing ID, and paste the new ID from Google Analytics into the box:
(Again, we've blurred out the ten-character code in this example.)
Next, click the blue button to update your book, course, or bundle:
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.]