Recent Posts

Why Don't I Use Leanpub?

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:

  1. No self-publishing experts suggest Leanpub.
  2. Leanpub is not a professional authoring tool.
  3. Leanpub does not have great formatting.
  4. Getting feedback by publishing in-progress does not make sense for him. Who would want to read a book more than once?
  5. Leanpub is focused on IT, so it’s a narrow distribution channel. No bestselling authors outside of IT are using Leanpub.
  6. 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!

The type of in-progress publishing we advocate is called “Lean Publishing”. It’s a nod to Eric Ries.

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:

  1. Write the whole thing in stealth mode and then publish it all at once. Have a launch and hope for the best.
  2. 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:

  1. Leanpub used to be really hard to use, so only computer programmers could figure it out.
  2. 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.)
  3. 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:

In a couple years, when an aspiring author is considering writing and publishing something, whether it’s genre fiction published in serial, or an in-progress book about the latest great Javascript framework, the question should be the same:

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, 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:

  1. Why track book sales with Google Analytics
  2. What you need before you start (prerequisites)
  3. Short instructions for advanced users who already know their way around Google Analytics
  4. Step-by-step instructions for beginners
  5. How to test that your setup works fine
  6. How to read Google Analytics reports to sell more books
  7. 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.

  1. First we need to locate the UA tracking ID in Google Analytics. Log in to Google Analytics at and click Admin.

  2. 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 Property, click Tracking Info and then click Tracking Code.

    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

  3. In the 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 YOURBOOKNAME part 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 homepage:

    In the Your Account drop-down menu, click Dashboard.

    Click the Books tab.

    Click the blue Edit button 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 Analytics option. Click Analytics.

  4. On the Analytics page, paste the UA tracking ID you previously copied from Google Analytics into the field Google Analytics Code (optional).

  5. Don’t forget to click the Update Book button. 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.

  1. First edit this regular expression TEMPLATE:


Replace BOOK_OR_BUNDLE_NAME with the exact slug of your book’ or bundle’s landing page at Do not include any slashes. A slug is the part of the URL that follows immediately after (for books) or (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:

  1. Then create a goal in Google Analytics by visiting and clicking this sequence of links:

    -> click Admin in the main horizontal menu
    -> click Goals in the VIEW column
    -> click the red NEW GOAL button
    -> click the Custom radio button in the Goal setup section -> type the name of your goal in the Name field, i.e. Book1 purchase
    -> under Type, select the Destination radio button
    -> in Goal details, under Destination, there’s a drop-down menu in which you must select Regular expression
    -> paste your unique and modified regex ^(\/b)?\/BOOK_OR_BUNDLE_NAME\/(.*)\/thankyou$ into the field to the right of the Regular expression drop-down menu
    -> switch Value to On and 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 Goal button, 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.

  2. 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.

  1. Copy the following regular expression template and paste it into your favorite text editor such as Notepad or TextEdit for editing:


  2. 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!__

    BOOK_OR_BUNDLE_NAME is 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.

  3. Let’s now find out what the exact address of your book on is. In Leanpub’s admin area where you edit your book, in the menu in the left sidebar, click Landing Page to 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.

  4. 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: (if you have a book)

    or (if you have a bundle)

    Your book’s unique address under is this YOURBOOKNAME or YOURBUNDLENAME part, or everything that follows That’s the part with which you need to replace the BOOK_OR_BUNDLE_NAME placeholder in our regular expression template.

  5. 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 BOOK_OR_BUNDLE_NAME with

    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 BOOK_OR_BUNDLE_NAME part with

    His result would be this unique regular expression:

    In short: remove and replace only the  BOOK_OR_BUNDLE_NAME part 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.

  1. Access Google Analytics at and click Admin in the main menu.

  2. After you’ve made sure that you have selected the proper account from the drop-down menu in the left-most column Account, click Goals in the View column (the right-most one).

  3. Click the red + NEW GOAL button.

  4. In the Goal setup section, there are two radio buttons: the already preselected Template and Custom. Click Custom and then click the Next step button to proceed.

  5. We’re now in the Goal description section. First, Google Analytics wants you to name your goal properly so that you can recognize it among other goals you might set up later.

    In the Name field, 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.

  6. Under Type, select the Destination radio button and click the Next step button to proceed.

  7. We’re now in the Goal details section where you will finally copy and paste the regular expression you have prepared!

  8. Under Destination, click the drop-down menu where Equals to is now displayed and select Regular expression.

  9. 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_NAME part with the unique address of your book, as I explained before in this article.

  10. If your book is not free, set the Value switch to On (otherwise, skip this step). In the input field next to it, where you see XY on 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 26.

    If you turn on this Value switch, 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.

  11. Click the Create Goal button 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.

  1. Go to the already familiar book edit page and in the left sidebar menu, click Coupons. An Edit Coupon page will be loaded.

  2. In the Discounted Price input field, enter 0.00. This enables you to buy your own book without spending real money.

  3. Set both the Start date and the End date to 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.

  4. Set the Max # Uses to 5. That means that you can buy your book five times for testing purposes.

  5. Under 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.

  6. Click Create Coupon to 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.

  1. When you create a coupon, Leanpub takes you to the list of all coupons, like on the image below.

    In the Coupon URL column, you’ll see a link starting with - click it to be taken to your book’s landing page.

  2. 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 Now button on Leanpub will now be framed in yellow: click that button and complete the purchase.

  3. The purchase is complete once the page ending in /thankyou loads 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.

  1. After logging in at, in the left sidebar menu click Real-Time and then click Conversions.

  2. Under Viewing: 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.

  3. In the 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:

  1. Acquisition metrics (how did you acquire your visitors, subscribers and buyers - a.k.a. traffic)
  2. Behavior metrics (what people do on your website)
  3. 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:

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 Here they are and the examples of their respective ‘thank you’ pages:




  1. The ^(\/b)? part is here because all bundle URLs start with /b, but book URLs don’t. Meaning, /b at the beginning of the URL is optional. This part of the regular expression matches whether or not a URL starts with /b.
  2. The \/BOOK_OR_BUNDLE_NAME\/ part matches exactly the URL of our book or bundle on
  3. The (.*)\/thankyou$ part instructs Google Analytics to match one or more characters until it finds the string /thankyou at 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:

  1. Authors who have written only one book
  2. Authors who have written more than one book can track each book separately
  3. Authors who have created bundles consisting of their own books or other authors’ books
  4. Authors who have created packages for their books
  5. Authors who track their book(s) using only one Google Analytics account
  6. Authors who track their book(s) using multiple Google Analytics accounts
  7. Buyers paying with credit card and with Paypal
  8. 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.

Leanpub Authors as Speakers for AirConf

published Jul 24, 2014

Short Version

If you’re a Leanpub author who likes speaking at technical conferences, contact Igor Lebovic from AirPair at They’re doing a cool virtual conference called AirConf, and we’re partnering with them in some promotional work.

Long Version

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.

Removing the Combined Write Tab and Dropbox Sync Option

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:

a) Dropbox
b) Write tab
c) GitHub

There are multiple reasons behind this, but a few of them are:

  1. The option to have both Dropbox and Write tab options active at the same time is confusing.

  2. 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.

  3. 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 and select the “In my browser on Leanpub” option.

GitHub Integration

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 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 ( 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

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 ( 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

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 ( for helping us beta test this feature!