published Aug 28, 2014
by Peter Armstrong, Leanpub Cofounder
Today Jurgen Appelo wrote a very well-written post entitled “Why I Don’t Use Leanpub”.
Go read it now. Seriously.
Now that you’re back, you’ll know that Jurgen essentially makes the following arguments:
- No self-publishing experts suggest Leanpub.
- Leanpub is not a professional authoring tool.
- Leanpub does not have great formatting.
- Getting feedback by publishing in-progress does not make sense for him. Who would want to read a book more than once?
- Leanpub is focused on IT, so it’s a narrow distribution channel. No bestselling authors outside of IT are using Leanpub.
- Leanpub has high royalties (90%) but does not drive readership, so the book has less impact.
These are interesting points. There is much in them that is valid, actually. However, they also miss some of the point about what Leanpub is good for, and how Leanpub should be used.
The fact that there is so much validity in them, however, as well as some misguided points, is why we’re posting this here.
This post is not a rebuttal; it is me providing a whole bunch of context around all of the arguments. This way, you can have a more sophisticated understanding of what we are doing, and judge the arguments on their own merits.
First, however, the way the post starts makes me so thrilled:
It seems not a week goes by without someone asking me, “Why don’t you publish on Leanpub?” or “Have you considered writing on Leanpub?” or some other variation of the same question.
As a startup founder, seeing this is fantastic! This hints at the best three words in the entire world.
No, not “I love you” – I’m talking about the other three words: “Product-Market Fit”!
Anyway, reading that paragraph is so thrilling to everyone at Leanpub that I’m going to paste it in again. That way, whenever any of us look at this post in the future we get to read it twice:
It seems not a week goes by without someone asking me, “Why don’t you publish on Leanpub?” or “Have you considered writing on Leanpub?” or some other variation of the same question.
OK, with that fun out of the way, let’s get to the Serious Business of considering the arguments.
1. No self-publishing experts suggest Leanpub.
This is actually a huge achievement on our part.
Since I wrote most of the copy on the homepage and the author page, as well as an entire book, called Lean Publishing, explaining what we are trying to do, I am so proud of this.
When you look at Leanpub’s homepage and the author page, you will not see the words “self publishing” anywhere. I hate the term. It’s the polite way of saying “vanity publishing”. If I wore glasses, I wouldn’t be able to say it without looking down my nose while saying it.
Leanpub is not a platform for self-publishing.
Leanpub is a platform for publishing in-progress books.
Leanpub is the best way in the world to publish a book while you’re writing it. This is true whether you’re writing a programming book, a business book or even a cookbook!
Leanpub is called Leanpub because of Eric Ries and his Lean Startup ideas.
I founded the Vancouver Ruby Meetup Group in 2007, at roughly the same time as I founded Ruboss, the company that created and runs Leanpub. (Back then it was called the Vancouver Ruby/Rails Meetup Group.) In 2009, before he was super-famous, Eric Ries actually talked at my meetup! I titled the event “Eric Ries (!!!) - The Lean Startup: a Disciplined Approach…”. His talk was called “The Lean Startup: a Disciplined Approach to Imagining, Designing, and Building New Products Speaker”.
Leanpub is trying to do for publishing (yes, for publishing, not to publishing) what Eric Ries and The Lean Startup did for startups.
After Eric spoke at my meetup in April 2009, we went for drinks, and over some tasty scotch we talked about publishing his blog as a book. The publishing platform that Scott Patten and I were working on would be able to do that, trivially. (Back then it was called Sopobo, which we thankfully renamed to Leanpub. Thanks Eric!)
The result was Eric Ries’s first book. No, not The Lean Startup. I’m talking about Startup Lessons Learned.
This book, a collection of Eric’s excellent blog posts, organized by month, was the first book published and sold on Leanpub. It was published and sold its first copy on April 21, 2010. I’m a romantic, and that date is my wedding anniversary, which is the perfect day to launch products.
Anyway, from that day forward, we did not focus on convincing anyone that we were a good way to self-publish. We convinced people that we were a good way to publish in-progress books according to the Lean Publishing principles.
Here’s the definition of Lean Publishing, which I’ve been saying at conference talks around the world (NYC, Frankfurt, Brisbane, SF and Edinburgh) over the past couple years:
Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.
This applies for both self-published authors, and for publishers.
One of the bestselling books on Leanpub, The Rails 4 Way, is an Addison-Wesley book. It was published on Leanpub as it was written, and then retired when it was complete. Obie and the other authors had a great experience writing it using our platform.
Do you think Addisson-Wesley considers it a self-published book?
2. Leanpub is not a professional authoring tool.
Leanpub is a way to publish and sell in-progress ebooks.
Leanpub is not in the text editor, word processor or page layout business. Yeah, sure, we added a way to edit your Leanpub books in the web browser, but we did this primarily for demo purposes and as a way for new authors to kick the tires if they didn’t have a Dropbox or GitHub account to use to sync with us. Leanpub is as much in the authoring tool business as GitHub is: not at all.
This is great, by the way!
You can use many tools to write on Leanpub. I use a combination of Emacs and iA Writer. I like Emacs since I’m a nerd, and I like iA Writer since it makes the entire focus be on your writing while writing Markdown, and the minimal formatting gets out of your way. (I’m writing this blog post in iA Writer, in Markdown.)
3. Leanpub does not have great formatting.
At Leanpub, we believe that for an in-progress book, formatting is just procrastination.
You should not be spending your time formatting; you should be spending your time writing. The amount of formatting that we support is essentially what Markdown supports, with some book-specific extensions for things like asides, footnotes, etc.
However, we do believe that semantic things like callouts, asides, etc are needed. Currently we support Asides (with A>), Warnings (W>), Tips (T>), Errors (E>), Discussions (D>), etc. And you can add custom icons using any icon in the amazing Font Awesome library. By the way, we love Font Awesome so much that we paid $1999 to be sponsors of Font Awesome Black Tie’s Kickstarter campaign.
So Jurgen, if you’re reading this, you can customize your asides with custom icons, so it could be that we kind of do what you want. And it could be that we should add a Callout section. Email me if you want to discuss that!
Anyway, that’s not really important. The important thing is this:
Once your book is done and you have written every word in it, what to do next?
Well, for one, that is the perfect time to do the formatting!
So, we support easy InDesign export with one click! This way, you can use a professional formatting tool to make your book look good. But the key is, you are doing this once, at the end of the writing process. This is much more efficient than doing it throughout the writing process.
4. Getting feedback by publishing in-progress does not make sense for him. Who would want to read a book more than once?
I’ve written a lot about this already, so I’ll keep it short:
Publishing in-progress makes the most sense for computer programming books, since technology changes so quickly. You need to reach the innovators and early adopters, or “earlyvangelists” in Steve Blank’s terms, while the information is still current. If you wait to publish until your book is done, then the innovators will have gotten everything they need from blog posts and moved on. You need grassroots buzz around a book from thought leaders, and thought leaders don’t read tired old books.
However, it’s a lot deeper and broader than that.
I recently read Ben Horowitz’s book The Hard Thing About Hard Things. It was a fantastic book.
But I’d already read about half of it before! Where? On Ben’s blog. Blogging lets you develop your voice and build an audience. Much of what you write on a blog can be refactored (to use a programming term) into book material.
If you are writing a book, whether it is a programming book, a business book or another type of non-fiction book, you can go about it a couple of ways:
- Write the whole thing in stealth mode and then publish it all at once. Have a launch and hope for the best.
- Publish parts of it as you are going, and get traction and feedback from readers.
Note that #2 can be done by blogging, by using Leanpub, or by doing both! This is why we have one-click blog import functionality: chances are if you have a blog, it has some good raw material for your book!
This is true for technical books, but also true for business books and other non-fiction.
Now, fiction is a bit trickier: for fiction, you typically do only want to read it once.
The solution here is serial fiction. I’ve talked about this a lot at publishing conferences, connecting this to everything from Victorian England (Charles Dickens, Mary Elizabeth Braddon, Wilkie Collins, etc) and Fifty Shades of Grey, which started as Twilight fan fiction called Master of the Universe.
We’re at the beginning of a renaissance for serial fiction. Watch this space.
5. Leanpub is focused on IT, so it’s a narrow distribution channel. No bestselling authors outside of IT are using Leanpub.
It is true that no bestselling authors outside technical and business topics are using Leanpub. This is due to a number of factors:
- Leanpub used to be really hard to use, so only computer programmers could figure it out.
- The initial traction that Leanpub got was in the computer programming and agile community. Since Leanpub is primarily growing by word of mouth, this explains our current distribution of books. (I like to joke that we are a viral loop startup, but that we have the world’s slowest viral loop: at every cycle through the loop, it involves someone writing part of a book. Think of Leanpub as kind of like Ning in this regard.)
- Markdown seems scary. Now, this is actually a problem that will go away as much better funded companies (e.g. GitHub) expose more and more people to Markdown. Also, Microsoft Word is a generational thing: my son’s generation will not be as attached to it as my father’s. Hopefully Leanpub can play a small role in that happening.
6. Leanpub has high royalties (90%) but does not drive readership, so the book has less impact.
This is a false choice.
First, our royalty rate is actually 90% minus 50 cents, so it’s $8.50 on a $10 book (85%) and $17.50 on a $20 book (87.5%).
But at every price point, our royalty rates are better than Amazon KDP, which is essentially 35% between $0.99 and $2.99, 70% between $2.99 and $9.99, and 35% at $10 and up. I say “essentially” since it’s more complex; the actual pricing page for Amazon is here.
Now, why is this important? Simple:
At Leanpub, authors own their work and can sell it wherever they want. This includes on Amazon and Apple.
Since we pay better royalties, it makes sense for authors to send their direct traffic (from Twitter, their blog, and mailing list) to Leanpub. However, it also makes sense for authors to publish their Leanpub books on any other channel that works for them in terms of getting sales.
This is why we encourage authors to sell their Leanpub books on Amazon KDP and Apple.
By the way, if they use KDP Select, they can’t sell anywhere else (including Leanpub). So, obviously, we don’t encourage that, since it destroys the business model of every other bookstore and publisher in the world. But if a Leanpub author wants to publish their book in KDP Select, they are free to do so–they should just retire the book on Leanpub first, to comply with Amazon’s terms of service.
In short, with Leanpub you can have your cake and eat it too! You can write using your favorite tools, publish on Leanpub as you are writing and when you are done (earning a great royalty rate the entire time), and also publish on channels like Amazon and Apple when you’re done, in order to get the reach that you want.
Now, does that mean Leanpub is perfect?
Right now the Leanpub website is kind of ugly, especially for readers after the purchase is completed. We’re fixing that.
Also, one thing which we really want to do is help our authors build their own email lists. We’re going to be integrating MailChimp to do this. This is something we’ve been asked for a lot, and we wanted to ensure that we did it the right way. We want to be transparent for our readers, so that readers do not get any emails they don’t expect, etc. But we think we’ve figured this out now, so stay tuned.
Furthermore, the process of reading Leanpub books on mobile kind of sucks right now. You need to drag files into iTunes or send them to your Kindle somehow. And who knows what you do on Android. We’re fixing this. Yesterday we submitted the first version of the Leanpub reader app to Apple for review. Hopefully it will show up in the App Store in a few weeks. Now, it won’t be able to buy Leanpub books (so the whole “mobile purchasing” story still sucks), but you’ll be able to read your Leanpub books and add new books to your Wish List. (Yeah, we’re adding wish lists too, finally!)
Finally, we have done about 1% of what I want to do for serial fiction. I want Leanpub to be the best way in the world to write, publish and sell serial fiction, and we’re nowhere near that yet. At Leanpub we love fiction authors, especially the genre fiction authors who have been marginalized historically. The snobbery toward self-published authors is only surpassed by the snobbery of literary fiction toward genre fiction or serial fiction. (The great people I met at GenreCon in Brisbane know how I feel about this.)
The goal is this:
Why Don’t I Use Leanpub?
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 email@example.com. 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!