Find Out Where Your Leanpub Book Sales Are Coming From (a.k.a. Setting Up Conversion Tracking in Google Analytics With Regular Expressions)
published Aug 14, 2014
Guest Post Author Bio
Visnja Zeljeznjak co-founded a web agency in 2002 and distilled her experience into her first book Recurring Revenue For Web Agencies, published with Leanpub. Visnja writes articles about running a web development business at Simpfinity.com, her company’s upcoming productivity software for web development agencies.
If you’re publishing your book with Leanpub, you’re probably responsible for your own book marketing and sales too. For an online entrepreneur - and book authors are entrepreneurs - there is one tool that makes the biggest difference between having a chance online and not having it. Google Analytics is that tool.
The best news is that Leanpub is already integrated with it, but there is still some manual work you need to do in Google Analytics to complete the process of tracking book sales. This tutorial will teach you how to set up the so-called conversion tracking goals by using something we call regular expressions.
Regular expressions are currently the only way to track Leanpub book sales. If you’ve never written one, they do seem scary. Fortunately, even inexperienced and non-technical book authors are capable of using regular expressions to set up book sales tracking. This tutorial’s main goal is to remove the scary part of that task.
How this article is organized (table of contents)
Skip directly to the chapter that interests you the most:
- Why track book sales with Google Analytics
- What you need before you start (prerequisites)
- Short instructions for advanced users who already know their way around Google Analytics
- Step-by-step instructions for beginners
- How to test that your setup works fine
- How to read Google Analytics reports to sell more books
- For those who want to know more
Why track book sales with Google Analytics
Google Analytics can help you figure out where people who bought your book are coming from. Hundreds of reports in Google Analytics can show you exactly which marketing efforts of yours are working spectacularly and which are a complete waste of time. For example, Google Analytics can help you measure:
- whether you’re wasting your time on Twitter or not (see how this Leanpub author used Google Analytics to answer this very question)
- whether or not you’re getting buyers from organic Google searches
- the exact percentage of people who read your email newsletter and subsequently bought your book
- whether or not you’re getting return on your paid advertising campaigns on Facebook, Google AdWords or Reddit
What you need before you start (prerequisites)
Before I show you how to set up goals with a regular expression, let’s first make sure that you’ve completed three necessary steps.
Throughout the tutorial, I will be using screenshots from my own Google Analytics account and my own author interface on Leanpub.
Prerequisite #1: you have already set up a Google Analytics account.
If you don’t have one, read Google’s official instructions on how to create a Google Analytics account. It’s easy to setup with any email address you own.
We will assume that you’ll be tracking your book sales with the same Google Analytics account that you’re now using to track your website visitors. You don’t need a website to be able to track book sales on Leanpub, but most authors do have it, and that will be my default assumption in this tutorial.
Prerequisite #2: you have already entered your unique Google Analytics tracking ID (something that looks like this: UA-12345678-1) into the Leanpub admin.
If you haven’t done this yet, here’s how and where you do it.
First we need to locate the UA tracking ID in Google Analytics. Log in to Google Analytics at https://www.google.com/analytics/ and click
You will see something like this:
In the left-most column
Account, make sure that you have selected the proper account from the drop-down menu. This is important to people who are tracking multiple websites under the same Google Analytics account because they will have multiple entries here. Select the one that you will be using for tracking your book sales. If you have only one website in your Google Analytics account, it will be listed here as the only option.
In the middle column
Tracking Infoand then click
The Google Analytics interface will show you a big bold tracking ID (in my example, the tracking ID for my website is
UA-46516970-1, yours will be similar). Select that code with your mouse in your browser in its entirety, copy it (CTRL-C / CMD-C) and paste it in your favorite text editor, i.e. Notepad or TextEdit for later use.
That’s everything we need to do in Google Analytics for now. Let’s now switch to Leanpub.com.
In the Leanpub.com book admin area (attention: it has been completely revamped in July 2014), we need to find the page to paste the UA tracking ID into.
The quickest way to get there is to go to the following address:
Simply copy the above address into your browser’s address bar (you need to be logged into Leanpub for this to work instantly). Make sure that you substitute the
YOURBOOKNAMEpart of the address with the exact address part of your own book on Leanpub. If you’re not sure what to put here, read on.
The Leanpub page that we’re looking for is also reachable by clicking around Leanpub’s web interface.
Follow this sequence of links, starting from the upper right corner of the Leanpub.com homepage:
Your Accountdrop-down menu, click
Click the blue
Editbutton which appears to the left of the cover of your book that you want to track.
In the left sidebar menu, click
Settings. It expands to show the
On the Analytics page, paste the UA tracking ID you previously copied from Google Analytics into the field
Google Analytics Code (optional).
Don’t forget to click the
Update Bookbutton. Congratulations, you have now successfully integrated your Leanpub book with your Google Analytics account!
Prerequisite #3: you have already published your book on Leanpub.
It makes no sense to track purchases before you have published the book on Leanpub. Publishing on Leanpub means that you have pressed the ‘Publish’ button in the Leanpub admin area, making your book ready for the readers to purchase. Here are Leanpub’s official instructions how to complete that final step of publishing on Leanpub.
If you’re not ready to publish just yet, it’s ok, this tutorial can wait. Bookmark it and return later.
Short instructions for advanced users who already know their way around Google Analytics
So you have pasted your UA tracking ID into Leanpub and have a book published? Let’s now do what you have come here for: let’s prepare a regular expression and create a Google Analytics goal with it.
- First edit this regular expression TEMPLATE:
BOOK_OR_BUNDLE_NAME with the exact slug of your book’ or bundle’s landing page at Leanpub.com. Do not include any slashes. A slug is the part of the URL that follows immediately after
https://leanpub.com/ (for books) or
https://leanpub.com/b/ (for bundles).
For example, my book’s landing page on Leanpub is this:
The slug for my book is this:
And my unique regular expression becomes this:
Then create a goal in Google Analytics by visiting https://www.google.com/analytics/ and clicking this sequence of links:
Adminin the main horizontal menu
-> click the red
-> click the
Customradio button in the
Goal setupsection -> type the name of your goal in the
Namefield, i.e. Book1 purchase
Type, select the
-> in Goal details, under
Destination, there’s a drop-down menu in which you must select
-> paste your unique and modified regex
^(\/b)?\/BOOK_OR_BUNDLE_NAME\/(.*)\/thankyou$into the field to the right of the
Regular expressiondrop-down menu
Onand enter the dollar value, which should be the minimum purchase value of your book. Skip this step if you’re giving away your book for free.
-> click the
Create Goalbutton, and you’re done with Google Analytics for now.
Scroll down this tutorial to find more detailed, step-by-step instructions with screenshots on how to create a goal in Google Analytics.
Test your setup. Scroll down this tutorial to find detailed instructions how to test easily.
Want to know the details about what this regular expression does and how it matches Leanpub URLs? At the end of this tutorial there’s a section with answers to this and similar advanced questions. In short, this regex is universal, it should cover tracking of all types of books and bundles on Leanpub, and it allows you to track each of your books separately.
Step by step instructions with screenshots (longer version for beginners)
We have now successfully integrated your book’s Leanpub pages with Google Analytics. Before we’re ready to create the goal in Google Analytics, let’s first prepare our regular expression so that we can easily copy and paste it into Google Analytics when we need it.
Step 1: preparing the regular expression
We’ve created a template of a regular expression that looks like one line of gibberish characters. Your job will be to edit one specific part of it, copy it to a safe place and then paste it into a certain field in Google Analytics when the time comes.
Here’s the deal: the following step is not hard at all. You just need to be extra careful not to delete, add, or mistype any characters. If you do, the tracking won’t work. That’s why people find regular expressions scary: errors are hard to identify because the regular expression itself is hard to read.
Don’t worry: at the end of this tutorial I show you exactly how to test your tracking so that you are sure that everything works great.
Copy the following regular expression template and paste it into your favorite text editor such as Notepad or TextEdit for editing:
You’re not done yet! You need to EDIT this part of the regular expression:
You need to REPLACE that part with the exact address of your book’s landing page as it appears on leanpub.com!__
BOOK_OR_BUNDLE_NAMEis just a placeholder we use in this tutorial to show which part of the regular expression every book author needs to edit and adapt to his or her own situation.
Let’s now find out what the exact address of your book on Leanpub.com is. In Leanpub’s admin area where you edit your book, in the menu in the left sidebar, click
Landing Pageto expand and display items in the submenu. Click
View Landing Page. You might want to click the little rectangle that is shown for this menu item to view your book’s landing page in a new window.
You’ll see your book’s landing page. Take a look at the address of your book in the adress bar of your browser, it shows something like this:
https://leanpub.com/YOURBOOKNAME(if you have a book)
https://leanpub.com/b/YOURBUNDLENAME(if you have a bundle)
Your book’s unique address under leanpub.com is this
YOURBUNDLENAMEpart, or everything that follows
https://leanpub.com/. That’s the part with which you need to replace the
BOOK_OR_BUNDLE_NAMEplaceholder in our regular expression template.
Lost? Let’s take a look at an example.
My book’s landing page is this:
So, when I was editing the regular expression template for my purposes, I took this regular expression template:
and I replaced
My final result was this regular expression which I copied and pasted into Google Analytics:
Want another, simpler example, where the unique book address contains no dashes (-)?
Take this Leanpub book: The Agile Agency.
Its landing page is this:
The author of this book should take edit this regular expression template:
and he should replace the
His result would be this unique regular expression:
In short: remove and replace only the
BOOK_OR_BUNDLE_NAMEpart of the template and don’t touch, delete, or edit any other character in the template. Double-check and triple-check that you didn’t unintentionally add extra slashes (/) or backslashes (); your unique book address should not contain any of those.
If you find any of this too demanding, just show me your book on Leanpub in the comments to this tutorial and I’ll write a regular expression for you.
Step 2: creating a book purchase goal in Google Analytics
A goal is a set of instructions that tells Google Analytics which action to track. A book purchase is the action we will be tracking. Every time one of your readers purchases your book, Google Analytics will record that purchase as a conversion and show you all kinds of useful reports about that conversion.
Access Google Analytics at https://www.google.com/analytics/ and click
Adminin the main menu.
After you’ve made sure that you have selected the proper account from the drop-down menu in the left-most column
Viewcolumn (the right-most one).
Click the red
+ NEW GOALbutton.
Goal setupsection, there are two radio buttons: the already preselected
Customand then click the
Next stepbutton to proceed.
We’re now in the
Goal descriptionsection. First, Google Analytics wants you to name your goal properly so that you can recognize it among other goals you might set up later.
Namefield, enter an arbitrary name of the goal, for example
Book1 purchase. The name should be short and distinctive. If you want, you could give your goal a more descriptive name.
Type, select the
Destinationradio button and click the
Next stepbutton to proceed.
We’re now in the
Goal detailssection where you will finally copy and paste the regular expression you have prepared!
Destination, click the drop-down menu where
Equals tois now displayed and select
In the field next to this drop-down menu, paste the regular expression that you have previously prepared. Once again, you should replace the
BOOK_OR_BUNDLE_NAMEpart with the unique address of your book, as I explained before in this article.
If your book is not free, set the
On(otherwise, skip this step). In the input field next to it, where you see
XYon the image above, I suggest you enter the minimum price at which you’re currently selling your book on Leanpub (you can always change this value later). For example, my books currenly sells at $26 and that’s what I entered in that field - number
If you turn on this
Valueswitch, be aware that your data will not be completely accurate. Every purchase will be shown as having the fixed value that you entered, but not all transactions will be worth that exact value. For example, some people choose to buy your book at higher prices, and some people will use your discount coupons and buy at lower prices. Arguably, the average value will be your minimum price, so it makes sense to use the minimum price here as the best approximation.
At this moment, it is not possible to track exact purchase values for Leanpub books (although Google Analytics is used for this exact purpose). At the end of this tutorial I explain why.
Create Goalbutton and you’re done setting up conversion tracking in Google Analytics. You’ll see a screen like on the image below.
That wasn’t so hard, was it? You’re doing great!
Let’s now make sure that Google Analytics is really tracking our book sales.
How to test that everything works ok
To speed up the testing process, you’re going to now pretend you are a reader and you are going to purchase your book on Leanpub.
If your book is free, simply visit your book’s landing page and buy your own book. The purchase is complete once a page ending in
/thankyou loads in your browser’s address bar.
If your book is not free, the best way to test is to create a coupon for a free purchase on Leanpub. A coupon is actually a specially coded link that you generate using Leanpub’s admin interface.
To create a free purchase coupon for the purposes of testing Google Analytics tracking, follow the steps below.
Go to the already familiar book edit page and in the left sidebar menu, click
Edit Couponpage will be loaded.
Discounted Priceinput field, enter
0.00. This enables you to buy your own book without spending real money.
Set both the
Start dateand the
End dateto today, meaning that the coupon will expire tomorrow. We’ll test this today and there’s no need to keep this coupon active anymore. You can always edit the dates later if you ever need to re-test conversion tracking.
Max # Usesto 5. That means that you can buy your book five times for testing purposes.
Note, you can leave a quick note for yourself for the future, i.e. enter “For Google Analytics Conversion Tracking Testing Purposes Only”. In the future you will probably create many coupons, so you’ll want to know which one is which.
Create Couponto save the coupon.
Now that you’ve created a free purchase coupon, use it to buy your own book for free. You need at least one real purchase to test the tracking you’ve set up.
When you create a coupon, Leanpub takes you to the list of all coupons, like on the image below.
Coupon URLcolumn, you’ll see a link starting with http://leanpub.com - click it to be taken to your book’s landing page.
You’ll notice that your book’s landing page looks a little bit different. It’s because you’re visiting a specially coded address for buying your book with a coupon. The big green
Buy Nowbutton on Leanpub will now be framed in yellow: click that button and complete the purchase.
The purchase is complete once the page ending in
/thankyouloads in the address bar of your browser.
Let’s now return to Google Analytics to see whether or not it has logged our purchase.
Google Analytics reports data in near real-time. This allows you to see sales almost as they happen, within seconds or minutes.
After logging in at https://www.google.com/analytics/, in the left sidebar menu click
Real-Timeand then click
Goal Hits (Last 30 min). You should see a list of your goals, similar to the image below. In your case, there will be just one goal named
Book1 purchase(or whatever you named it before). In my case that you see on the image below, there are two goals: one for tracking my newsletter subscriptions and the other one for tracking book purchases.
Goal Hits (Last 30 min)column there should be one conversion logged: that would be your purchase. If you see this conversion, congratulations! You have successfully completed this tutorial.
What to do if my test fails and I don’t see a conversion?
First, wait longer - up to 24 hours, especially if you’ve just created your Google Analytics account for the first time.
Second, make sure your UA tracking ID has been installed properly. Read this Google Analytics Help page for more information about what to check and how.
Third, go over all the steps in this tutorial once again. Double-check every step. Common mistakes are these:
- bad regular expression (maybe you accidentally deleted or added a character?)
- UA tracking ID not entered in the Leanpub admin area
- book not published.
Fourth, ask for help in the comments to this tutorial. I’ll be glad to help. Let me know if you get stuck on any of the steps. It’s possible that the screens you see do not match the images or instructions in this tutorial (Google or Leanpub might have upgraded their software since the time of publishing of this tutorial).
How to read Google Analytics reports to sell more books
There are hundreds of reports in Google Analytics and you have your whole career to obsess over them daily. But there are only three major areas important to every online entrepreneur:
- Acquisition metrics (how did you acquire your visitors, subscribers and buyers - a.k.a. traffic)
- Behavior metrics (what people do on your website)
- Outcome metrics (what people do before they leave your website)
For the purposes of this tutorial, I want to show you one simple report that displays the most relevant data in a single view, without any customization. I have chosen the All Traffic Acquisition report because it answers the following questions at a glance:
- Which sources are bringing in the most traffic?
- Which sources are keeping the most people on my landing page the longest?
- Which sources convert most traffic to book sales?
To view your All Traffic Acquisition report, log in to Google Analytics and click Acquisition -> All Traffic in the left sidebar menu.
You’ll see a table with data such as this:
What you’re looking at is a snapshot from my Google Analytics account which I use to track my book purchases. I’ve highlighted a couple of interesting data points.
Which data is important in this view?
- Source / Medium column shows me where people are coming from. They’re coming mostly from Google, social media, other websites, paid advertising, and my email newsletter.
- Sessions column shows me the number of visitors (roughly speaking), per online source.
- Bounce Rate, Pages / Session and Avg. Session Duration tell me how interested people are in my website content, and I can see how are various sources performing. For example, my email subscribers seem to be the most interested in my content. This tells me I should invest more time, money and effort in my newsletter.
- The three right-most columns (Goal 2 Conversion Rate, Goal 2 Completions, Goal 2 Value) are shown in this table because I’ve set up goals and conversion tracking. When you have successfully completed this tutorial, data such as this will show in your Google Analytics. For example, these three columns are telling me the value in dollars of each and every online source.
So, what do I, as an online entrepreneur, do with this data? The data helps me make smarter decisions about where should I be spending my time every day. It helps me see the results of my hypotheses such as “If I change the text of my Google AdWords ads, will my paid advertising start converting to book sales?”. Without the data coming from conversion tracking, I have no idea which changes to make and whether my changes are working or not.
Teach yourself Google Analytics
The All Traffic report is only one tiny example of what you can do with the data that this tutorial has just helped you gather. It is a highly simplified example and there is no room in this article to get me started on the challenges of digital analytics today.
If you want to dig deeper into the wonderful world of digital analytics, I recommend three sources of top-notch knowledge:
- Avinash Kaushik’s blog “The Occam’s Razor”. Avinash is god of analytics, period. Avinash’ educational posts such as this and this will help you make the most sense of digital analytics.
- Thomas Baekdal of the Baekdal magazine - incredibly smart guy who knows the future of digital media and digital analytics. I read his articles religiously.
- Google’s Digital Analytics Academy is the official training central. It’s packed with educational videos.
For those who want to know more
What does the regular expression in this tutorial do, exactly?
I thought you’d never ask!
^(\/b)?\/BOOK_OR_BUNDLE_NAME\/(.*)\/thankyou$ matches three distinctive types of web page addresses (URLs) on Leanpub.com. Here they are and the examples of their respective ‘thank you’ pages:
^(\/b)?part is here because all bundle URLs start with
/b, but book URLs don’t. Meaning,
/bat the beginning of the URL is optional. This part of the regular expression matches whether or not a URL starts with /b.
\/BOOK_OR_BUNDLE_NAME\/part matches exactly the URL of our book or bundle on leanpub.com.
(.*)\/thankyou$part instructs Google Analytics to match one or more characters until it finds the string
/thankyouat the end of the URL. Leanpub assigns a unique and random purchase ID to every transaction and puts that unique ID in the URL. That’s why our regular expression needs to: a) accommodate for all possible unique purchase IDs and b) be as simple, as universal, and as accurate as possible.
Which cases does this conversion tracking cover, exactly?
This regular expression has been written to accommodate all Leanpub books, packages and bundles. It is universal and currently all Leanpub authors can use it.
The following Leanpub use cases are supported, too:
- Authors who have written only one book
- Authors who have written more than one book can track each book separately
- Authors who have created bundles consisting of their own books or other authors’ books
- Authors who have created packages for their books
- Authors who track their book(s) using only one Google Analytics account
- Authors who track their book(s) using multiple Google Analytics accounts
- Buyers paying with credit card and with Paypal
- Buyers using coupons
Are there any cases where this tracking might not work properly?
Other than tracking not working at all, there is one case which deserves attention.
Many authors have their own website where they promote their books that they sell over Leanpub. This means that they have created book landing pages on their own websites. I have done the same too: this is my website landing page, and this is my Leanpub landing page. My website is my home and I naturally want to promote my book there, while Leanpub is my main bookstore where I put my book for sale.
The regular expression in this tutorial looks for all page addresses starting with
/BOOK_OR_BUNDLE_NAME/ and ending with
/thankyou. Every time Google Analytics catches that a page matching this condition has loaded, it will log a conversion.
If you’re using the same Google Analytics account to track your website and Leanpub landing pages, make sure that you have no pages starting with
/BOOK_OR_BUNDLE_NAME/ and having
/thankyou anywhere after that in the address. Avoid using
/thankyou as a partial page name anywhere on your website, because pages named like that might trigger an unwanted conversion in Google Analytics.
This means that your real sales conversions will still be tracked, but your Google Analytics might show more conversions than there actually are. If this is the case, simply rename the pages on your website so that they don’t containt
/thankyou and you should be fine.
Google Analytics supports eCommerce conversion tracking, which shows the exact purchase value. Why didn’t we set that up, instead of goals?
It’s because Leanpub still does not support eCommerce conversion tracking. When you were setting up your goal, I told you to use your book’s minimum price as your fixed goal value. Google Analytics can do much better that that, for example it can show you exactly how much a reader has paid, up to the last cent. We’ll have to wait until Leanpub fully implements eCommerce tracking.
Your next steps
Bookmark this page for later use if you still haven’t published your book and return to it when you’re ready to publish.
If you get stuck at any step in this tutorial, please do not hesitate to ask for assistance in the comments! Your comments will help improve these tutorial.
published Jul 24, 2014
If you’re a Leanpub author who likes speaking at technical conferences, contact Igor Lebovic from AirPair at firstname.lastname@example.org. They’re doing a cool virtual conference called AirConf, and we’re partnering with them in some promotional work.
We’ve been talking to the guys at AirPair, and what they’re doing is a good fit for lots of Leanpub authors.
Specifically, they’re putting on a virtual conference called AirConf, and many Leanpub authors would be great fits to be speakers. If you look at the speaker list, you’ll see a few are there already, and not just Obie Fernandez, their CTO. (I’m on a panel too, talking about why developers should write books, hopefully on Leanpub of course.)
Leanpub and AirPair are both great ways for developers to build and monetize their personal brands (yeah, the “personal brand” phrase still makes me cringe a little bit, but it’s actually totally valid). The great thing is how complementary AirPair and Leanpub are.
So, we’re going to be doing some promotional work around this. (Seriously. Leanpub doing marketing. Who knew?)
As part of this, we’re going to be featuring books by Leanpub authors who are AirConf speakers in the next Leanpub newsletter, and also in an “AirConf week” on the Leanpub homepage.
published May 12, 2014
We’ve recently removed the option to use both the write tab and Dropbox syncing.
Now, there’s just a really simple, mutually exclusive choice for books:
b) Write tab
There are multiple reasons behind this, but a few of them are:
The option to have both Dropbox and Write tab options active at the same time is confusing.
If someone makes a change on an offline computer, then makes a change in the Write tab on the same document, there can be conflicts.
We’re trying to declutter the author app.
If you have been using Dropbox syncing and the Write tab together and you want to continue using the Write tab, just go to https://leanpub.com/YOUR_BOOK/writing_settings and select the “In my browser on Leanpub” option.
published Apr 10, 2014
We’ve been working on GitHub integration for quite a while now, and I’m happy to announce that it is ready to use.
To start, go to https://leanpub.com/YOUR_BOOK/writing_settings and follow the instructions. If you do that, you can ignore the rest of this email, but here’s a quick set of steps to illustrate how it works:
First, create a repository on GitHub and add leanpub (https://github.com/leanpub) as a collaborator.
Create a manuscript directory in your repository and put the content from your current Leanpub manuscript folder in it.
Second, go to https://leanpub.com/YOUR_BOOK/writing_settings.
Select “Use Git and GitHub” and enter the path to your book’s repository on GitHub. E.g. if your repository is at
then you would enter
Now you can push to GitHub and we’ll pull from you before generating your book.
If you were using Dropbox before, your dropbox folder will still be on your computer, but we won’t be using it for anything. You can safely delete it once you have moved everything to GitHub.
You may also be interested in setting up a post-commit hook. This uses the Leanpub API (https://leanpub.com/help/api) and a GitHub service hook to preview your book every time you push to Leanpub.
First, you’ll need your Leanpub API key, which you can get at https://leanpub.com/dashboard/account#the-leanpub-api.
Now, set-up your Leanpub webhook.
Go to your repository’s webhooks page. Click on the “Configure Services” button and look for Leanpub in the list of services. Enter your API key and your book’s slug. Make the Webhook active, and click on “Update Settings”.
We’ll be making improvements to our Git and GitHub integration as we get feedback from you, our authors, so please let us know what you think.
P.S. Special thanks to Nicholas Zakas (https://leanpub.com/u/nzakas) for helping us beta test this feature!
Introducing the Leanpub Affiliate Program: Optional, Opt-in and 50% (!) of Minimum Price on Affiliate Sales
published Mar 11, 2014
At Leanpub, we want to be the best way in the world to write, publish and sell ebooks. So far, we’ve been focusing much of our efforts on the writing and publishing aspect, and less on the selling aspect.
This is something we’re going to address in 2014.
The first step was supporting packages and extras.
The second step we’re taking is building an affiliate program, which we launched on March 7.
Marketing a book on the internet is hard. This is true for everyone, from self-published authors to traditional publishers. It’s also true of digital goods in general: books aren’t unique snowflakes in this regard.
An affiliate program can help here. (For those who don’t know, an affiliate program on the internet involves sharing part of the revenue from a purchase with some third party that drove the purchaser to the product landing page. The affiliate can be anyone.)
However, there are lots of affiliate programs on the internet. To be actually helpful to authors, our affiliate program would need to be compelling, in order to attract and motivate potential affiliates. However, since we pay 90% minus 50 cents royalties, there’s not much room for us to maneuver here, in terms of supporting an affiliate program from our revenue. After PayPal takes their cut, we’re left with about 7% plus 20 cents in revenue per sale, and offering anything meaningful would destroy our profitability and thus hurt our growth.
So, we took a step back and thought about what successful affiliate programs we knew about.
Dreamhost, for example, helped drive its growth by offering up to $97 per signup to the affiliate, and they’re a successful web hosting company.
Even more impressively, the Thesis WordPress theme earned over a million dollars in revenue.
Yes, for a WordPress theme.
What Thesis had in common with Dreamhost is that it used an aggressive affiliate program. If my memory is correct, I think when I bought Thesis it cost about $160. (Once upon a time, the MVP version of Leanpub was briefly based on WordPress MU.) Anyway, of the $160 cost of Thesis, I think that about half of the revenue went to the affiliate.
So Thesis, like Dreamhost, had massive success by offering a good product and a really aggressive affiliate program.
Now this is a model we can get behind!
So, here’s how the Leanpub affiliate program works:
It is strictly opt-in. No books are added by default; all new and existing Leanpub books need to opt-in to being in the affiliate program. For multi-author books, only the primary author can opt the book into the affiliate program.
Any Leanpub user can be a Leanpub affiliate, provided they obey the Leanpub Terms of Service and the Leanpub Affiliate Program Terms of Service and provided that they have not issued chargeback requests for books they have purchased.
If a book is in the affiliate program, any Leanpub affiliate user in good standing can get an affiliate link for it.
If the affiliate link is used to navigate to a book landing page, the affiliate gets 50% of the minimum price of the book at the time of the sale. This revenue is entirely subtracted from author royalties.
After opting in to the affiliate program, the book is available for all affiliates right away.
At any time, the primary author can remove a book from the affiliate program.
Affiliate revenue is subject to the 45-day hold, just like book royalty revenue.
Refunds also apply to the affiliate revenue from the purchase.
We pay affiliate revenue monthly, the same way we pay author revenue.
Now, your first instinct might be to think that point #4 (the 50% of minimum price) is totally insane.
The thing is, if you think of affiliate sales like found money (which it largely is), or if you compare it to traditional publishing royalties, then it’s totally fine. Think of it as your marketing budget, but entirely on commission – which is how you want it.
Typically an author gets 10% of a publisher’s revenue from a book. On a physical book, the publisher gets about half of the sticker price. So, on a $40 print book, the publisher gets $20, and the author gets $2. And on a $20 ebook sold from the publisher website, the author once again gets $2.
Now, I want to emphasize that the 50% affiliate portion is of the minimum price, not the suggested price. So, say you have a book with a minimum price of $15 and a suggested price of $30, and someone buys your book for the suggested price.
Here’s what this looks like:
A $30 No-Affiliate Purchase of a $15 Minimum Price Book:
- Purchase is $30.00
- Leanpub earns $3.50
- Author earns $26.50 (8.83 times better and $23.50 better than the traditional 10%, which is $3)
A $30 Affiliate Purchase of a $15 Minimum Price Book:
- Purchase is $30.00
- Leanpub earns $3.50
- Affiliate earns $7.50 (50% of the $15 Minimum Price)
- Author earns $19.00 (6.33 times better and $16.00 better than the traditional 10%, which is $3)
By the way, this is why we made the affiliate revenue portion be of the minimum price, not out of what the customer paid.The reasoning here is that anything above the minimum price represents goodwill from the reader to the author, and there is no reason an affiliate should get a piece of that. Also, it would potentially hurt goodwill to do so.
What about for books with a higher minimum price?
Here’s how that affiliate math works, with a couple simple examples:
A $20 Minimum Price, No-Affiliate $20 Purchase:
- Purchase is $20.00
- Leanpub earns $2.50
- Author earns $17.50 (8.75 times better and $15.50 better than the traditional 10%, which is $2)
A $20 Minimum Price, Affiliate $20 Purchase:
- Purchase is $20.00
- Leanpub earns $2.50
- Affiliate earns $10
- Author earns $7.50 (3.75 times better and $5.50 better than the traditional 10%, which is $2)
So, even with a really aggressive (and totally optional) affiliate program that comes entirely out of author royalties, as an author you still earn way more than you would with a traditional publisher! And instead of just your publisher marketing the book, you have a bunch of affiliates doing it.
What about multiple author books or books with causes? Well, that’s more complex, so here’s a couple scenarios showing how it works. The only thing you need to keep in mind is that the affiliate revenue comes off the minimum purchase price, and the rest is split up according to the current formula:
A $20 Minimum Price Non-Affiliate Purchase, where there are 2 authors (60% for Author A, 40% for Author B) and 2 causes (Author A’s cause gets 30%, Author B’s cause gets 10%):
- Purchase is $20.00
- Leanpub earns $2.50
- Author portion is $17.50, split into (d) and (e)
- Author A’s portion is $10.50, split into $7.35 for Author A and $3.15 for Author A’s cause
- Author B’s portion is $7.00, split into $6.30 for Author B and $0.70 for Author B’s cause
- Math check: 2.50 + 7.35 + 3.15 + 6.30 + 0.70 = 20.00
A $20 Minimum Price Affiliate Purchase, where there are 2 authors (60% for Author A, 40% for Author B) and 2 causes (Author A’s cause gets 30%, Author B’s cause gets 10%):
- Purchase is $20.00
- Leanpub earns $2.50
- Affiliate earns $10.00
- Author portion is $7.50, split into (d) and (e)
- Author A’s portion is $4.50, split into $3.15 for Author A and $1.35 for Author A’s cause
- Author B’s portion is $3.00, split into $2.10 for Author B and $0.90 for Author B’s cause
- Math check: 10.00 + 2.50 + 3.15 + 1.35 + 2.10 + 0.90 = 20.00
Anyway, we hope that this new program helps many of you jumpstart your Leanpub book marketing.
To enrol your book, go to https://leanpub.com/YOURBOOK/edit_affiliate
Coupled with the book packages feature, we’re excited to see what you do with these tools!
The next tool we build on this front will probably be an email drip course feature. But first we need to do some design work, to simplify the site and improve the usability of the features we already have.
Oh yeah, and before all that, we’re finally restoring GitHub integration as an option alongside Dropbox and web-only. GitHub integration will be ready later this month. (I say restoring GitHub integration, not adding, since we actually had supported GitHub before switching to Dropbox!)
Peter, Scott and Len
P.S. To help ensure that everyone plays nice, we have lots of fine print at https://leanpub.com/affiliateterms