Posts

ThumbmarkJS: A free, open source device fingerprinting JavaScript library for the web

I needed a decent JavaScript fingerprinting library. I wanted something that was 'good enough': not crappy, but didn't need to be perfect. I noticed the great FingerprintJS , but sadly, they changed their license to a paid one. Boo! What is a good alternative to FingerprintJS? There are alternatives out there too, but to be honest, they all have faults. FingerprintJS is great, but they're monetizing their product in a way that I don't like. I might need hundreds of thousands of requests per month, but I can't pay thousands of dollars. It doesn't need to be perfect either, so I don't want to pay such a high premium. ImprintJS used to be a thing, but it's now archived for a few years already. ClientJS hasn't been updated for a few years either. It is promising, but I find it a little too complicated to extend and I see nowhere any statistics on how good is it. BroprintJS is the new kid on the block and hats off for trying, but it's very lim...

How to get source and medium programmatically with JavaScript - just like Google Analytics

Image
To make smart marketing decisions, you need to know what the Return On Marketing Investment (ROMI) is. When you're a webshop that does immediate transactions, it's easier to set up Google Analytics to serve you. However, if you need to understand longer customer relationships, Lifetime Values, etc, you need to get your hands on raw data. The obvious idea that comes to mind is: "I just need to get the source, medium, campaign etc. data per each visitor" and you quickly realize that Google Analytics doesn't allow you to do that. You need a custom solution. I have found two online that solve the problem This one with FirstSession and ReturningSession cookies set The Lunametrics one , which is a bit more verbose, but has a more extensive list of search engines These solutions are just fine, but, no-one's maintaining them. They're old. They don't evolve. And they don't support other paid channels than Google search. What about Bing? Facebook? Also, bot...

How to access AWS S3 with pyspark locally using AWS profiles tutorial

At Zervant , we currently use databricks for our ETL processes, and it's quite great. However, there's been some difficulty in setting up scripts that work both locally and on the databricks cloud. Specifically, databricks uses their own prorpietary libraries to connect to AWS S3 based on AWS hadoop 2.7. That version does not support accessing using AWS profiles. Internally, we use SSO to create temporary credentials for an AWS profile that then assumes a role. Therefore, reading the ACCESS_ID and ACCESS_SECRET from the .credentials file is something we don't want to do. In order to accomplish this, we need to set two hadoop configurations to the Spark Context fs.s3a.aws.credentials.provider com.amazonaws.auth.profile.ProfileCredentialsProvider This is done by running this line of code: sc._jsc.hadoopConfiguration().set("fs.s3a.aws.credentials.provider", "com.amazonaws.auth.profile.ProfileCredentialsProvider") Note! You need to set your environment var...

Don't use gross churn to compare SaaS businesses

Image
Whether you're optimizing your ad spend or in talks with investors about what your SaaS business is worth, you need to calculate your customer lifetime value right. And while there are good shortcuts, using them can easily lead to a completely wrong number , resulting in really bad decisions. In my role I've come to realize that the shortcuts rarely work well enough. In this article I'll cover the following challenges in calculating churn: Fluctuating / seasonal churn Churn-and-return customers Churn of different price tiers is asymmetric Churn is non-linear over time Saturated markets And finally the best way to calculate lifetime value that account for these challenges. Calculating lifetime from retention Typically lifetime value is calculated by dividing your average monthly revenue per account (ARPA) by your monthly churn. You can get your ARPA by dividing your monthly recurring revenue (MRR) by the number of paying customers you have. And so, if your ARPA is 10 € and y...

Snowflake UPSERT operation (aka MERGE)

You want to insert data to a table, but if a corresponding row already exists (by some rule, e.g. unique key) you want to update that instead of adding a new row, keeping the dataset's unique requirements intact. That's an "UPDATE AND INSERT" operation, or UPSERT. Some SQL languages have native support for it.  PostgreSQL has UPSERT as native. Also MySQL supports the operation with INSERT and ON DUPLICATE KEY UPDATE. How do you do UPSERT on Snowflake? Here's how: Snowflake UPSERT i.e. MERGE operation Snowflake's UPSERT is called MERGE and it works just as conveniently. It just has a different name. Here's the simple usage: MERGE INTO workspace.destination_table d USING workspace.source_table s ON d.id = s.id AND d.val1 = s.val1 WHEN MATCHED THEN update SET d.val2 = s.val2, d.val3 = s.val3 WHEN NOT MATCHED THEN INSERT (id, val1, val2, val3) VALUES (s.id, s.val1, s.val2, s.val3); Here the destination_table and source_table are of similar form,...

AWS Glue python ApplyMapping / apply_mapping example

Image
The ApplyMapping class is a type conversion and field renaming function for your data. To apply the map, you need two things: A dataframe The mapping list

The Glue code that runs on AWS Glue and on Dev Endpoint

Image
When you develop code for Glue with the Dev Endpoint , you soon get annoyed with the fact that the code is different in Glue vs on Dev Endpoint glueContext is created in a different manner there's no concept of 'job' on dev endpoint, and therefore no arguments for the job, either So Mike from The MIS Theorist asked if there was a simpler way. And sure there is!

AWS Glue, Dev Endpoint and Zeppelin Notebook

Image
AWS Glue is quite a powerful tool. What I like about it is that it's managed : you don't need to take care of infrastructure yourself, but instead AWS hosts it for you. You can schedule scripts to run in the morning and your data will be in its right place by the time you get to work. The downside is that developing scripts for AWS Glue is cumbersom , a real pain in the butt. I first tried to code the scripts through the console, but you end up waiting a lot only to realize you had a syntax error in your code.

Using survival plot to analyze churn in Power BI

Image
I did not  guess I'd be working with Kaplan-Meier survival plots so soon. Analyzing churn and trying to figure out what kind of users churn more likely is not so easy. In order to calculate churn, you need to have a good volume of users that you can follow month over month, having a number of active users per month and what share of them are left behind every month. But what if you want to select a different set of users, another segment? Producing an analytics cube with the necessary dimensions takes time. And if you end up with a segment that doesn't have high volumes every month, interpreting the results can be quite tricky.

Create a funnel analysis tool with Redshift and Power BI in 5 minutes

Image
If you're not collecting events from your product, get started right away! Events are a great way to collect behavioral data on how your users use your data: what paths they take, what errors they encounter, how long something takes etc. When you have events, there isn't a lot you cannot  analyze.

How to ETL in Amazon AWS? AWS Glue for dummies

Image
You can do ETL in AWS in a few different ways: Glue DataPipeline A custom solution, e.g. a Docker

An insights strategy for winning companies

Image
An executive summary Companies struggle to gain maximum benefit from analytics and insights since Analytics is seen as a support function, not a business partner and therefore is  not prioritized high enough Analytics is separated from business processes and insights are produced away from execution Under-resourced, inflexible analytics stack, which doesn’t enable speed to react to changing needs

A more holistic purpose of analytics

Image
Why do people make bad decisions? Mostly because of insufficient or wrong information, but not always. So what should be done about it?

Simple Big Data setup on Amazon AWS

Image
Everyone wants to do some big data stuff, right? In all honesty, no-one cares if your data is big or small - size doesn't matter. What matters is your ability to take any size of data and generate understanding from it. At some point the data you are gathering might become inconvenient to process with more traditional tools. It might  be that some big data tools might help you - or not. The bottom line is, it is a tool you want to have in your toolbox.

Simple way to query Amazon Athena in python with boto3

Image
ETL takes time and it's a lot to maintain. Sometimes it breaks when you didn't expect a string to contain emojis. You might decide the transformation needs to be changed, which means you need to refresh all your data. So what can you do to avoid this?

Know exactly how much you pay to acquire any user: Python with Google API

Image
So you've read about how to optimize your marketing efforts through data . With that, you should know the kind of users different marketing campaigns are bringing in. Some campaigns might be bringing more high-quality users than others. Can you do that now?

What is the easiest way to train a neural network?

Image
We've been surveying our customers since forever, but recently we've started to become more and more hungry on data. As an invoicing service provider for micro entrepreneurs, Zervant's  customers are of all varieties. One interesting data snippet we've found out is that roughly half of our customers are part-time entrepreneurs. But which half is it?

Prioritize your features with the Kano method

Image
Prioritizing new features requires intuition, but it can definitely be made better by using data. As there's always a limited amount of bandwidth to do stuff, you need to relentlessly prioritize what to do next. An easy way to fail is to be too busy doing the wrong things.

Spot your churning users sooner with statistics

Image
The girl (or guy) you're dating has called you on average five times a week lately. As a neurotic analytics enthusiast/stalker you happen to know this. Now it's been three days without a call. Should you be worried?

Becoming a data-driven company

Image
How does a company become data-driven? Here's what I've learned at Zervant. Radiate information If you want to turn the culture more data-driven, radiate information. You'll never know what will stick. Radiating information also has the side-effect of evangelizing the work of analytics: people will remember you exist and they will take analytics into consideration more easily. Oh right, when we're building this we need to talk to analytics about what to measure!  Write an internal blog, give short presentations about an information nugget, etc. Frequency is more important than the perfect quality of content. Teach People love to learn new things. They will first tell you they're in no way analytical-minded and far from technical, but they will eagerly learn. De-mystifying analytics will help everyone in your organization to speak the same language and be on the same page about what analytics can do for them. As I've held workshops on analyt...

Popular posts from this blog

ThumbmarkJS: A free, open source device fingerprinting JavaScript library for the web

Snowflake UPSERT operation (aka MERGE)