Raspberry Pi Pico Tips and Tricks

Saturday 10 August 2013

Observations of the impact of publishing the D3 Tips and Tricks book as a web page on Leanpub.

First of all apologies to those readers who are expecting a pure d3.js experience from reading this post and an apology to those readers who are expecting a pure Leanpub experience. This is a bit of both :-)

For the benefit of both groups, d3.js is an awesome JavaScript library / framework for visualizing data in a web page and Leanpub is a remarkable publishing option for authors who want to distribute their work in a slightly different (but cool) and very open way.

On the bright side, those interested in d3 might discover some interesting books to read or a way to publish their own work, and Leanpub devotees might find that there is a way for them to analyse how their book is being received in the World :-)

What's this blog post about?

Well, a while back (28 May 2013), Scott Patten of Leanpub announced on the Leanpub Google groups site that;
You can now put the content of your book on the web automatically every time you hit the publish button. This page will be available to everyone on the internet, not just people who have purchased your book.
So, in addition to providing a framework for publishing and distributing an authors work, Leanpub added the ability to have the entirety of a book published as a single web page, available online for anyone to view.

Now, that may seem to be slightly strange thinking, but as Scott explained;
... your biggest risk as an author is obscurity, not security. Don't worry about people stealing your book. Worry about people not knowing about your book. Putting your book on the web will allow Google (and other search engines) to index it, and people will be able to find you by searching for all of your content, not just the small amount you can put on your book's landing page.
At the time I thought this was an excellent idea (and (spoiler alert) I still do). So I immediately selected this as an option for D3 Tips and Tricks, so that people could not only download the book in a format suitable for reading as pdf, epub or mobi file types, but they could also discover the content online.

Now, at the time of this feature going live, there was an obvious debate over what sort of impact this feature would have on downloads of a book. I therefore offered to share what (if anything) I discovered during this process. This blog post is the observations on what I've seen thus far with D3 Tips and Tricks and it incorporates using a d3.js script (via dc.js) to help :-).

Did using this feature result in additional interest for D3 Tips and Tricks?

The first piece of data I'll present is from Google Analytics (I'd like to point out at this time that I'm no expert in using Google Analytics. Please prepare yourself for disappointment if you think I have any special insights or advice to give on its use).

Here we can see the total number of pageviews for the D3 Tips and Tricks site on Leanpub. The cursor is presented at about the time that I added the `read as a web page` feature and it is evident from the graph that after that time, the number of page views increased. As there were no major alterations I made to the book at that time (other than adding the `read as a web page` feature), I am making the presumption that this increase is as a result of implementing this feature.

(The slight increase in the last two weeks would most likely be as a result of a significant addition to the book in the form of information on crossfilter and dc.js)

It should be remembered that this is only representative of people who visited the site. Not people who downloaded the book.

What proportion of visits was attributable to adding the `read as a web page` feature?

Luckily we can select individual pages for comparison and the following graph shows as a proportion, the number of visits to the /D3-Tips-and-Tricks/read page and the overall number of visits;

The number of visitors who went to the read page (orange line) has remained fairly constant and by the roughest of evaluation methods (just looking at the graph) it would appear that the increase in the overall pageviews is due in most part to the additional traffic going to the read page.

So, did using this feature result in more downloads of D3 Tips and Tricks?

This will be a question that more Leanpub authors will be interested in. Did the access to the content on the web influence the number of people downloading the book?

This is where things start to get a little more complicated. Because D3 Tips and Tricks (the book) can be downloaded for free, there would be no barrier to people reading the content online (for free) to also download the book if they wanted to (for free). With this in mind, I don't believe that the results that I have would be a firm indicator for the results that would occur with a book that cost money to download.
Never the less... Here is an indication (in green) of the numbers of people who also visited the 'purchases' portion of the site.

The data does not appear to have been occurring since before approximately the middle of May, (I'm not sure of the reason, but it may be due to a change in the way Leanpub was running the site) however, there are two clear weeks of data from before the change and to my eye there doesn't appear to be an easily discernible difference in the number of visits to the purchased page from before the end of May to any time afterwards.

That does surprise me a little as I would have expected some degree of difference, but it is possible that the numbers are too low to show anything other than a REALLY significant change. It is also possible that this is as a result of the pricing of D3 Tips and Tricks. If it had been a non-free book, I wouldn't feel feel comfortable predicting what any impact would have been.

Is there any other impact on the introduction of his feature?

Good question, because this gives me a reason to crank up some d3.js graphs!

So I took this as an opportunity to build a dc.js / crossfilter graph that showed the relationship between the number of downloads of the book that occurred per day, the number of sales  per day (where a sale is someone kindly donating money for the book (remember, it can be downloaded for free, so this metric is for where a reader decides that they would like to donate when downloading)), the amount of royalties that is then accrued per day (I still find it very heart warming that people donate (it's like a pat on the back) and I've been more than happy to enjoy the occasional beer while thinking kindly of them :-)), The number of downloads per day of the week, the amount of royalties per day of the week and the total number of sales per day of the week.

Now, I've deliberately removed the values from some of the axes here for privacy reasons, so the graphs are indicative of differences, not amounts, likewise I have obfuscated the graphs slightly by applying a smoothing interpolation (this was done internally to the dc.js files for those interested).

From this we can confirm the earlier observation that the number of downloads of the book does not appear to have changed from before to after the end of May.
By the same token, there does not appear to have been any significant change in either the number of people who choose to donate when downloading the book or the amount that they donate. (again, it is possible that the sample population for this comparison is a little small to make this assumption, so take it with a grain of salt). If I was to REALLY squint hard when looking at the graphs, I might think that the number of sales has reduced, but the overall amount donated is pretty much the same.

The row graphs are pretty interesting. Obviously, Saturday and Sunday see a lower turnover than the weekdays, but interestingly, while the number of downloads and number of sales roughly correspond to each other, it would appear that the amount of royalties reduces on a Wednesday (this would indicate that while the number of sales stays the same, the amount paid (per donation) is less on a Wednesday than a Thursday or Friday). I have no idea what to make of that.

More interestingly (because this is a dc.js visualization) we can start selecting different parameters and discovering other things.

For instance, if I select all the records for donations prior to the end of May, there is a distinct increase in the relative amount of royalties received on a Thursday!

And if I flip the selection to all downloads after the end of May, It looks like Tuesday is a leader for royalties.

That in itself is weird.

Wrap up.

What have we learned?
The introduction of the `read as a web page` feature appeared to have the effect of increasing traffic to the book's content.
There did not appear to be an attributable increase or decrease in the number of downloads of the book as a result (although with the caveat that D3 Tips and Tricks represents a subset of books which can be downloaded for free which would be expected to skew the figures).

Future studies? 

It would be very interesting to get a similar interpretation of figures from other books, especially ones that have a minimum purchase price that is not $0.

Can you implement the same sort of graphs for your own Leanpub book? 

Sure! You'll need to find your own way with Google Analytics, but if you want to use d3.js, / dc.js and crossfilter, they are all open source projects which are available for use.
A copy of the file that I created to generate the graphs is here, but if you're unfamiliar with some of the JavaScript libraries involved, you may need to go through D3 Tips and Tricks first :-)


  1. How do you implement custom tooltips for points in the graph like Google Analytics display (eg.: Satuday, June 1, 2013; pageview 1000)

    1. Ahh... I recently added a piece to an earlier blog post (and into the book) that describes how to do this. See http://www.d3noob.org/2013/08/add-line-chart-in-dcjs.html (or in the book (https://leanpub.com/D3-Tips-and-Tricks) it's in the 'Adding a line Chart to dc.js' chapter. The tooltips in this case are added as a function of dc.sc, but they look good. There can be some use cases where their behaviour is 'quirky', but for what you describe I think they'll be good. You can see an example in action on the main dc.js page here (http://nickqizhu.github.io/dc.js/) (although the format of the date / time is different, I explain how to change that in the book / blog. Enjoy.

    2. Thank you :) ... I will look into it