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 ecommerce 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:
 The first aggregation processor has a sliding window duration of 60 minutes for calculating the conversion rate of the past hour.
 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(xy) > Count of records for last xy mins.
For instance: Count (12060) will represent the number of records for the second to last hour.
So, the relative conversion rate would be: Count (600)/ Count (12060)
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 (600) and Count (1200) in the following manner.
Count (600)/ (Count (1200) – Count (600)).
Say x = Count (600) /Count (1200), 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 


60Mins (Aggregated Stream) 

120Mins (Aggregated Stream) 
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.