Using StreamAnalytix to Calculate the Conversion Rate of a Website

Websites today are the cornerstone to drive business objectives and achieve revenue goals. Hence, business owners need to ask themselves the following questions:

  • Who are my potential customers?
  • What is their pattern of purchase?
  • How can I improve my website to increase business?

StreamAnalytix is an excellent platform for performing analytics on the web for any live clickstream data. You can track performance metrics of websites in many ways. One such measure is the relative conversion rate. Let’s take a look at what it means, how it’s derived and why it’s important.

Conversion Rate

The conversion rate is the percentage of users who take a desired action. A typical example of a conversion rate is the percentage of website visitors who buy something on the site.

For example, let’s say an e-commerce site is visited by 10,000 people in the last hour. During that hour, 200 users purchased something from the site. Thus, the site’s conversion rate is 200/10,000 = 2%.

Relative Conversion Rate

The relative conversion rate compares the conversion rate for the last hour with the second to last hour.

Relative conversion rates add more business value than conversion rates because they tell you which aspects of your value proposition would increase your conversion rate for the same visitor pool.

Using the above example, let’s say the conversion rate prior to the last hour was 4%. Then, the relative conversion would be 0.5.

The chart below shows conversion rate and relative conversion rate over a period of 24 hours.

Analysing Relative Conversion Rate with StreamAnalytix

You will need two aggregation processors:

  1. The first aggregation processor has a sliding window duration of 60 minutes for calculating the conversion rate of the past hour.
  2. The second aggregation processor has a sliding window duration of 120 minutes for calculating the conversion rate of the past two hours.

Now let’s try to represent the conversion rate in terms of aggregation results and simplify the calculations:

Count(x-y) -> Count of records for last x-y mins.

For instance: Count (120-60) will represent the number of records for the second to last hour.

So, the relative conversion rate would be: Count (60-0)/ Count (120-60)

Because our aggregation processors start together, they must have the same starting point i.e. y. Hence, we will represent our relative rate in terms of Count (60-0) and Count (120-0) in the following manner.

Count (60-0)/ (Count (120-0) – Count (60-0)).

Say x = Count (60-0) /Count (120-0), then the relative rate would be x/ (1 + x).

If we can calculate a ratio of our values from two aggregated processors(x), then we can simply insert x in the above equation and get the relative conversion rate.

Let’s Create a Pipeline which does this:

This represents a Kafka stream click stream data.

Here’s what it does:

ClickStreamSource
  • Reads from kafka and parses the clickstream data
  • Extracts useful information
  • Converts it to JSON.
60Mins (Aggregated Stream)
  • Accumulates all the records for sliding window duration of 60 minutes.
  • Performs the count (60-0) aggregation operation.
120Mins (Aggregated Stream)
  • Accumulates all the records for sliding window duration of 120 minutes.
  • Performs the count (120-0) aggregation operation.

These sliding windows will provide conversion rates every 60 minutes.

FlatMap operator Makes the aggregation output compatible to input to Join.
Join Merges the output from the two windows.
ConversionRateFormulaEvaluator Calculates x/ (1+x) using a few lines of Java code. (Optionally, you can also use Scala code using a Scala processor.)
RelativeConversionEmitter Pushes calculated relative conversion rate to kafka.

Result: The output of the enricher is the relative conversion rate

Conclusion

The relative conversion rate is an important aspect to monitor in business operations. For large volumes of data batch processing capabilities, StreamAnalytix can be extremely useful. Furthermore, StreamAnalytix can abstract out all the complexities of back end implementation and can assist you in building a solution with simple drag and drop components.

You can implement many complex use cases just by focusing on your business case and allowing StreamAnalytix to manage how the various technology components interact with each other and get the job done for you.

Author
Amarjeet Singh Khalsa
Senior Lead Software Engineer - StreamAnalytix