Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I’ve had the great privilege to be a small part of the R open source community, contributing packages like broom, gganimate, fuzzyjoin, and ggfreehand. In the process I’ve become friends and colleagues with brilliant statisticians and data scientists and learned to engage with data in powerful ways.
But there’s one thing that my colleagues and I haven’t gotten from R open source involvement: money. Until now.
Introducing the monetizr package
To this end, I am introducing the monetizr package, which lets you monetize a package through advertisements.
Suppose you’ve created a function:
This function takes its input and multiplies it by two. By enterprise software standards this is quite useful.
You’ve shared your function and people are using it:
But every time they use it, you are not capturing the value- you are in fact getting nothing from it. What a ripoff!
Marketably
The monetize package provides the marketably
function, which modifies a function to display an advertisement. (Why “marketably”? Because functions that return other functions should be adverbs). You can provide ads for paying third parties, or you can advertise your own work. Here I’ll add an advertisement for my blog:
Now, when anyone calls it:
You’ve captured some value!
Also try the html = TRUE
argument. Now thanks to htmltools, this will pop up in the user’s browser or RStudio “Viewer” window, where it is even harder for your customers to ignore.
You can also insert a delay (in seconds) after the ad is shown with pause
, much like YouTube’s ads:
Monetize an entire package
Usually you’ll want to monetize your entire package, not just a single function. So monetizr provides a way to make this convenient- market_all
:
Place this in the zzz.R file of your package to add advertising to all your functions. (See here for more on zzz.R).
By next week all of my packages on GitHub and CRAN will be monetized in this way, and I’m counting on others in the community to follow.
Impression Analytics
Ever since I entered industry I appreciate the importance of analytics: understanding how many impressions you are receiving, not just the number of clicks. Here those impressions are represented by the number of times each of your monetized functions is used.
The monetizr package supports this core business need. Simply define a route on your own website or back-end server to record an impression, and then your function will fire off a request to that site on each call:
This will send a GET request (with the response discarded) to
http://example.com/impressions/record?function=multiply_by_two&id=1
(Where id
is the index of the ad that was shown, among the choices given as ad
).
Upcoming Features
Functions that are currently in development for monetizr include:
expensively
: Have a function require a bitcoin payment with each calltemporarily
: Have a function offer a “free trial” for a number of uses or time period before requiring paymentpremiumly
: Have a function require payment to activate particular options.
If you have other suggestions, please open a GitHub Issue, or better yet hop on a call with one of our sales staff!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.