Author Archives: Kushan Shah


Kushan Shah

About Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

E-commerce Recommender Series: The Beginners Guide to keep your Product Recommendation Contextual

In the first part of the series on effective product recommendations for e-commerce, we discussed how we could use placements for recommendation section to get maximum click through rate to increase the average order size. Now, let’s head to the second part and learn why you should keep your product recommendation engine contextual & its best practices.

Quick Navigation:

Why it’s important to have a Contextual Product Recommendation Engine?

Once I was on an e-commerce store looking for buying a washing machine. I added a model to the cart. When I was on the cart page, the site recommended me other washing machines that I should consider buying. So mechanic! It’s so obvious that no one would buy a second washing machine even if you gave him 50% off.

Since the product recommendation was not contextual in above example, the store owner missed the opportunity to further increase the average order value.  To improve your e-commerce store sales it’s important that you have a smart production recommendation engine that always consider product category while serving product recommendations.

General Guidelines for Keeping Product Recommendation Engine Contextual

  • Don’t show products from same category unless the price low enough to impulse the user to buy another. Works with Books, DVDs, Music, Flash drives etc.
  • Accessories as recommendations work very well. E.g. while buying an iPhone, the customer would love to consider buying the case or the car charger.
  • Add-ons are good for upsell. Showing matching earrings with a purse would never be ignored.
  • Make sure that if you are up selling, it remains within the Average Order value or little more

Now that we have learned the general guidelines for production recommendation engine, it’s time we go into little depth and learn the best practices for content of product recommendation for different pages of your e-commerce store.

Best Practices for Home Page

Product Recommendation for Home Page

While user is on the homepage, you don’t know what she’s looking for. Hence, showing recommendations for a particular category would not serve the purpose.  Since we are not sure about users interest we highly recommend keeping the homepage product recommendation engine content generic. But if you are forced to do so, just do not communicate strongly.

What to show: Show top selling products for that day under the heading, “What people are buying today?”

Best Practices for Product Category Page

Product category page is a little more detailed page & here we know what types of product a user is interested into. Learning the user’s interest we should customize our offering in product recommendation engine.

What to show: Let’s say the user in on the category page of SLR cameras. Since we know that the user is interested in SLR Camera’s, a product recommendation will be a list of bestselling SLR cameras. Here, you can’t show camera lenses because you don’t know which camera a user is looking for.

Best Practices for Product Detail Page

Product Recommendation for Category Page

Consider a case when the user is looking for Cannon EOS 500D. She found the product on your site and now she’s on the product details page reading specifications. You can use this page to increase the order value.

What to show: Show a camera here, which is a little costlier than what she’s looking for, but offers more features. Changing her mind for a few $ should be difficult here if you are really offering value.

Best Practices for Shopping Cart Page

Product Recommendation for Product Detail Page

Shopping Cart Page is the most important page for you. On this Page you know exactly which product a customer is buying & hence offer the opportunity to increase the average order value by up selling your products.

What to show:  Consider the user is buying an SLR Camera. Since she is on your shopping cart page, you know exactly which SLR camera brand and model she is buying. Since the goal here is to make the user buy more we can show user a camera lens that can go well with the existing camera, a tripod or a photography magazine subscription.

Product Bundling

Product bundling is the best way to increase the order value. A Product Bundle is basically a group of products that you offer to your users, mostly at a discount. It’s a nice way to encourage impulse buying and increase order value. It isn’t bad as long as you are offering value.

To better understand the concept let us have a quick walk through of two examples of product bundling:

Bundling main product with accessories

Product Bundling

Show accessories that would suite the main product. This bundle works for every 10th buyer for a client of us. If someone were buying an iPhone, why wouldn’t she consider buying the case for 50% off? It’s completely contextual and you are offering value.

Bundling different products in same category

Product Bundling

Bundle many products in the same category. Give discount on the package. Show huge savings. This also works well with low priced products. Book, DVDs, Apps, Games and so many such products can be sold in bulk. The order quantity increases. So does the order value, and so does profit.

In the following blogpost we learned why Context of Product Recommendation is important and what content should be severed on each different pages of your e-commerce store. Use the practices mention in this post to improve the average order value of e-commerce store. In the next post, we will discuss the best practices and important elements of Product Recommendation.

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Price Elasticity Analysis for your E-commerce store

Consider that you have a successful E-commerce store with an above average conversion rate. Now, in order to encourage your consumers to buy and take conversions higher, you decide to offer discount on your products. The discount leads to a spike in sales which in turn leads to higher sales.

The sale has ended and now you are reviewing the performance of your campaign. Your campaign’s sales curve looks like this:

The price points in the graph above have resulted from subsequent 5% discounts considering $100 as the base price. From the graph, you realize that your sales grew from 20 to 80 percent because of the discounts you offered on your products.

Discounts help you acquire more customers, sell off your inventory quickly and help fetch more revenue. Having said that, it is important to note that discounts also decrease your margin and has an impact on your profits.  Hence, the ideal discount (and hence the price point) would be the one that helps you maximize your profits.

Coming back to our graph show above, let us try to see what the curve represents. This is the classic demand curve which shows that the Price Elasticity is negative since the sales increased with lower price. Rafi Mohammed, in his acclaimed book, “The 1% Windfall” gives an excellent analysis of the downward sloping demand curve.

I have summarized the key points from the book below:

  1. Different customers have different valuations
  2. Discounted prices attract customers with lower valuations as well as encourage repeat purchases
  3. A lower price leads to more units sold

Now since you are trying to understand which price point to go with in the future, we need to account for the above points namely: Customer’s valuation of product & Financial Motivations (Revenue Optimization, Profit Optimization). So now coming back to your example, how much should you price the product?

“Uh, $80, because then I sell the most units!”

Ah! Nope! You’re not trying to maximize no. of units sold, you’re trying to maximize profits.

Lets calculate profits, assuming that the per unit cost of your product is $80.

If we now plot the profits as a function of price points, we see a hump at the $90 mark.

Now we are getting somewhere. We have indeed found out the optimum price point that leads to highest profit. Awesome!

Constructing a demand curve for your products is a non trivial task. Firstly, you need data on your price points. You need an understanding of your customers, more specifically which factors do they value when buying your product? But if you were able to do it anyhow, you are able to gain a sizeable margin on your products. Doing this in the long run, gives you a scientific way of determining price points for your products. A way that is far more data driven, iterative and leaves you with a better understanding of your customers.

And by the way, if you ever want to know how many units you can sell at different price points, you can always try out our Product – E-commerce Price Discovery Engine

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Increase Your Store Revenue by Performing Shopping Basket Analysis

If you have an online store, then as an retailer you would certainly want to know how your product is performing online and the factors that are affecting its sale. And to know this, you need to collect data that provides in-depth information about buyer details and shopping behavior online. Further, it is also essential to identify the behavior of one product, compared to its counterpart. When you notice that few products in your store are performing better, then it becomes important to know whether these products were purchased together or were just complementary in nature. By carrying out Shopping Basket Analysis, this problem can be solved to a certain extent.

We carried out an analysis from a simple 2 by 2 chart comprising of top 20 highly sold products of clients involved in clothing business to learn how these products were related to each other. We used the transaction data of buyers to find the probability between two or more products purchased together by a buyer in a single transaction. We then put Tatvic Google Analytics Excel Plug-in into use and some pure excel functions to extract the relevant data.

Clothing Product Cycle

Product Data Analysis and Findings

Product Purchase Pattern Analysis

Shopping Basket Analysis:

  1. In 10% transactions of product “A”, product “B” was also purchased.
  2. In 17% transactions of product “F”, product “I” was also purchased followed by 12% transactions having product “S”.
  3. In approximately 5% transactions of product “I”, products R and S were also purchased.
  4. In 11% transactions of product “P” product “Q” was also purchased.
  5. Red circles in the diagram show hot zones where maximum slot of transactions happen and should be our focus.

Shopping Basket Recommendation:

Above insights can be used to decide optimum promotion and pricing strategies like:

  1. Ensuring that products being purchased in combination are on same page side by side.
  2. Highlighting those products on top landing pages of site.
  3. Providing discount in form of shipping benefits to group of products giving higher average order value.
  4. Finding out single product transactions and tie those products to moving items at discounted rate.

There is a whitepaper “Product Purchase Pattern Analysis” which covers this article in comprehensive manner. You can also use our Product Recommendation Engine to provide more product recommendations in different ways to your customers to enhancing up sell and cross sell conversions. In case you wish to analyze data in excel you can download excel version of shopping basket analysis dashboard here.

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

4 Elements to A/B Test for Product Recommendations to Increase Order Value

Testing Product recommendation means experimenting with different elements of recommendations section to make it more usable and convertible. There are different ways you can test product recommendations. Below are the elements you should test to improve performance of your product recommendations section.

1) Title

Title is the most important element of the recommendation section. The title is why people will see the recommendations. Sometimes, Title is the only thing visible in first fold.

Product Recommendation Title

Suggested titles to test:

      • “60% people who viewed above product also viewed these:”
      • “60% people who bought above product also bought these:”
      • “60% people who bought above product also viewed these:”
      • “60% people who viewed above product bought these:”

Note: “60%” is just used as an example above. That number would vary depending upon the user behavior.

2) Call-to-action

Call-to-action is why people will click and go further to buy more. It’s not every time that “Add to cart” button will get more clicks. We’ve seen instances where “Know more” as a prominent button get better conversions rates.

Call to action button

Suggestions to test call-to-action:

      • “Know more” as call-to-action button and “Add to cart” as a small link
      • Only “Know more” as a call-to-action button.

(No “Add to cart” CTA  tells customers that the seller wants them to explore the product before they buy)

3) Placement

WHERE you place product recommendation section is also important and hence it should be tested. For some sites, recommendations on one page might perform better than recommendations on other page.

Suggestions to test placements:

      • Product page vs Shopping cart page
      • Product page vs category page
      • Category page vs Shopping cart page
      • On product page, you can test it below the product details vs above the product details
      • On shopping cart page, you can try it below the “Checkout” button vs above it.

e.g.

Product Page with Product Recommendation

Product page

vs

Shopping cart page

Shopping Cart Page with Product Recommendation

4) Normal recommendations vs Bundles

A Product Bundle is basically a group of products that you offer to your users, mostly at a discount. It’s a nice way to encourage impulse buying and increase order value. When a customer is on a product page, you can suggest a bundle of products that would go well with that product.

Suggestion for test between different pages:

      • Test product bundling vs normal recommendations.

e.g.

Normal Product Recommendations Offer

Normal recommendations

vs

Product bundling

Normal Product Recommendations Offer

To carry out the above A/B Test on your product recommendation you can use tools like Optimizely and Visual web optimizer.

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Infographic: The Anatomy of an Ideal Product Recommendation

Does your product recommendation attract less clicks or traffic? Product recommendation is a great of way to increase the average order value of your ecommerce store.  According to Monetate, a product recommendation can increase your revenue by up to 300% & boost the average order value by 50%!

The following infographic is aimed at helping you increase the engagement on your product recommendation. You will learn 4 important elements of a product recommendation which are often overlooked & 6 best practices to follow to increase the clicks on your product recommendation. Apart from these tips, you can also use Google Related Products Feature to generate better product recommendations.

Infographic-product-recommendations-13

Use this code to embed this Infographic in your Blog/Website:

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

How to save your marketing dollars on your Customer Loyalty Program?

I am very much intrigued by the Customer Loyalty programs I observe across eCommerce sites I encounter. Indeed they are very much common place and have become a tried and tested tool to drive loyalty. What makes a marketing campaign stand out is the definitely the ROI fetched on the campaign and this led me to think if we could apply some form of analysis to improve the returns. Before I pull the rabbit out of the hat, let me walk you through the approach I followed.

Cohort Analysis gives us great insight into consumer action. So I pulled up some Google Analytics eCommerce data and started experimenting with cohorts. I wanted to understand Repeat Purchase Behavior and hence focus on two cohorts in particular:

1. Customers who made only one purchase on the website

2. Customers who made multiple purchases on the website

Let us first examine the proportion of consumers belonging to both the above mentioned cohorts.

Proportion of Transactions for One Time vs Repeat Consumers

 

There is indeed a stark difference between the two cohorts. A huge majority (85%) of customers are one-time customers. They do not come back and purchase again. This is a challenge faced by many sites and is not limited to a singular instance. If we were to compare the revenue contribution of the two cohorts we see that while the one-time consumers contributed towards  60% of the total revenue, the other cohort contributed a ‘whopping’ 39.5%. I have a reason for using the word ‘whopping’ and I will state it now.

“15% of the consumers contributed towards 39.5% of the total site revenue.”

Sweet, let me tell that to my boss!

Contribution to Total Transactions and Revenue by Cohort

 

Yay! We have identified the problem that the consumers are not sticking. So lets target them with an aggressive retention campaign. Lets send out discount coupons to all the one-time consumers to encourage them for future purchases. But would it seem fair to target the entire one-time consumer base to drive sales? Some consumers would go for the 2nd purchase without the incentive. The point I’m trying to drive home is sending out discount coupons to all the one time consumers would also erode your profit margin to a large extent.

Moreover, assume that the discount coupon initiates a future purchase with a value of  $50 in 10% of the cohort. If a voucher is sent to a consumer who would have re-purchased anyway, that results in a loss of $5 to the store owner. Note that these figures are ball park estimates but I encourage you to think about the implications.

Marketers have a limited budget and need to prove the efficacy of retention campaigns by measuring results. How would you do this? Predictive Analytics can be of help here. Where cohort analysis is descriptive in nature, predictive analysis helps you use your data to build models to predict consumer behavior. Think of it as a machine that converts data into actionable insights that give you better ROI.

Specifically in our case, predictive analytics can provide answer to this important question:

“Which customers should I target for discount coupons in order to maximize revenue?”

Does this question seem interesting? View a recorded version of our recent webinar where we show you how to build a Predictive Model for Discount Targeting using R

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

An Introduction to Collaborative Filtering

A typical consumer today uses multiple devices to surf the web and interact in many ways with your eCommerce business. For most stores, maximizing conversion and increasing order size in this environment is not only an enormous challenge, but also an incredible opportunity.

eCommerce stores also have a variety of marketing channels be it e-mail marketing, Social or Mobile Apps which help in increasing consumer interaction. A reasonably large ecommerce store has a large number of products to be displayed to a large number of customers across a variety of channels (or devices). Consumers experience information overload and seek help in selecting from an overwhelming array of products while merchandisers lost their relationships with consumers and seek to re-build and deepen those relationships by better helping consumers find products of interest. Hence, one of the questions that needs to be addressed is: Which product should be displayed so that the customer is most likely to buy it?

More recently, ecommerce stores have started adopting a wide range of mass customization techniques for customizing the consumer experience. The consumer experience includes the physical products, which can be customized in function or in appearance, and the presentation of those products, which can be customized automatically or with help from the consumer. Sites invest in learning about their customers, use recommender systems to operationalize that learning, and present custom interfaces that match consumer needs. Consumers repay these sites by returning to the ones that best match their needs.

Collaborative filtering is a way of making automatic predictions (filtering) about the interests of a user by collecting preferences from many other users (collaborating). The principle is like this: if several members of my community owned and liked the latest Apple gadget, then it is highly likely that I will too. Here is an example of how this technique is effectively tapped by Amazon:

Association rules have been used for many years in merchandising, both to analyze patterns of preference across products, and to recommend products to consumers based on other products they have selected. An association rule expresses the relationship that one product is often purchased along with other products. By contrast, collaborative filtering techniques based on user-similarity are more effective and personalized in a domain where consumer choices are very dynamic, such as online retail.

To sum up, by implementing collaborative filtering you can:

  • Convert browsers to buyers
  • Increase cross sell via either Product bundling
  • Build loyalty and increase customer lifetime value

Want to learn more about how you can leverage collaborative filtering for your business using R? Join us in our next webinar. More details here

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Google+ Hangout: The Future of Working with Data with Michael Koploy and Thomas Davenport

Hi folks,

Some of the guys from our team have watched the replay of this Google+ Hangout and we have found it quite interesting. Assuming that the majority of you guys that come here to check our blog posts out are also part of the web analytics world, we thought we should share this with you here.

We really hope you enjoy this cross-post from the Plotting Success blog from Software Advice !

Author and professor Thomas Davenport’s new book, Keeping Up with the Quants, serves as a “quantitative literacy” guide for managers as they wade through the world of data today and tomorrow. Keeping Up with the Quants, co-authored by Davenport and Jinho Kim, covers the basics of quantitative analytics, the essential habits of effective analysts and insight on how business users and top-ranking quants can best collaborate.

Michael Koploy, Managing Editor at business intelligence resource website Software Advice, recently hosted a Google+ Hangout with Davenport to discuss key points from the book and Davenport’s thoughts on the future of business analytics.

Among other topics, Davenport and Koploy cover:

  • The importance of balancing creativity with a regular, thorough analytical process
  • Why great companies hire great analysts–and why that isn’t likely to change anytime soon
  • Why visualization tools are effective at analyzing “Big Data”
  • How “Ph.Ds with personality” drive analytical innovation in business
  • Why everyone should dabble in coding

Check out a full recording of the hangout below:

For a full analysis and takeaways from the hangout, check out Koploy’s post on the Plotting Success blog: Hangout with Thomas Davenport: The Future of Working with Data. Be sure to check out Keeping Up with the Quants: Your Guide to Understanding Analytics, on sale now. And connect with Koploy on Twitter (@PlottingSuccess) and Google+.

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Highlights of the Amazon Web Services Summit, Mumbai 2013

As a data analytics firm, we understand the value of the cloud for data storage and processing. When we talk about cloud computing, we are very passionate about Amazon Web Services since it is a very rich platform that enables us to build our applications for various use-cases. We were curious to understand AWS and gain an insight into best practices and this led us to the annual AWS Summit at Mumbai. The AWS Summit is a one day cloud community event organized in 12 major cities around the world. The focus of the current event was on cost effectiveness, high availability, big data and security.

The keynote was delivered by Dr. Werner Vogels, CTO of Amazon.com where he talked about how AWS helps developers focus on the application rather than the infrastructure.

A range of breakout sessions were attended by team Tatvic.

In the Startup and Developer Track, one of the speakers talked about the four stages of a startup development lifecycle namely: Idea, MVP (Minimum Viable Product), Scale and Profitability. These ideas were inspired by Steve Blank’s book: The Four Steps to Epiphany. He also mentioned how a startup can effectively use AWS as they pass through each of these stages.

One of the other sessions that we found very useful was the Big Data Analytics session. Abhishek Sinha, Head of Big Data and Compute, spoke about how running Analytics on the cloud could be extremely effective since it was Elastic and scalable. Data objects could either reside in S3 or if in a database layer like DynamoDB. The data processing can be carried out on an EC2 instance or on a distributed Hadoop cluster with the use of Elastic Map Reduce. Finally, the processed results can be pushed back to S3, DynamoDB or Redshift. Whats more to this is that this entire process of Data collection, Computation and Storage can be automated with the help of Data Pipeline. Interesting !

The keynote and breakout talks left us with an even better sense of what AWS is about, how it has grown, what kinds of customers are using it, and what it can do.

Update – The videos from the AWS Summits held around the world can be found in this Youtube playlist

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook

Web Analytics Visualization through ggplot2

During our last webinar, we covered some of the basic ideas behind ggplot2, the R Visualization package by Dr. Hadley Wickham. In this blog post I will walk through the example that I covered during the webinar.

In order to carry out the examples yourself, you may download the sample datasets from this link

Creating visualizations is an iterative process. You start with a data set, generate some quick graphs that best depict the insights and keep on adding components/data to the graph to finally produce a viz that you can show in your reports. The idea behind ggplot2 is to make this process simpler and more effective at the same time.

Diving into our example, we want to explore how Transactions for a hypothetical ecommerce store have fared for a particular calendar year. The function which we used for plotting is ggplot() and we need to mention the data frame as one of the arguments. Now for a bit of ggplot2 terminology which I am quoting verbatim from the documentation.

  • aes stands for aesthetics and this controls how variables are mapped to the axis. In our example we map month to the x-axis and transactions to the y-axis.
  • geoms, short for geometric objects, describe the type of plot you will produce. In our case, we are plotting the data as a bar graph
  • stat stands for statistics which help us transform the data prior to plotting. In our case, its an identity transform so the data remains unchanged.

Here’s the R code :

require(ggplot2)
# Load the dataframe
mydata <- read.csv("./datasets/dataset1.csv")
head(mydata)
# Append a new column that maps month numbers to month names mydata$monthf <- factor(mydata$month,levels=as.character(1:12), labels=c("Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec"), ordered=TRUE)
# Plot Transactions vs Month ggplot(mydata,aes(monthf,transactions)) + geom_bar(stat="identity")
# Which month shows the highest transactions ?

You may now be on your way to follow the rest of the code and keep on improving our first visualization using the rest of the R code :

# Load data frame that includes Medium as a dimension
mydata_1 <- read.csv("./data/dataset2.csv")
mydata_1$monthf <- factor(mydata_1$month,levels=as.character(1:12),
labels=c("Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"),
ordered=TRUE)
# Facet the Transactions by medium ggplot(mydata_1,aes(monthf,transactions)) + geom_bar(stat="identity") + facet_wrap(~medium)
# What is the problem with this plot ?
# Exclude the mediums having zero transactions fresh_data <- subset(mydata_1,medium %in% c("cpc","organic","referral","(none)"))
# Re-plot ggplot(fresh_data,aes(monthf,transactions)) + geom_bar(stat="identity") + facet_wrap(~medium)
# Stack the plots vertically for easier comparison ggplot(fresh_data,aes(monthf,transactions)) + geom_bar(stat="identity") + facet_wrap(~medium,ncol=1) # Which medium performed best w.r.t transactions ?
# Load the data frame including an additional dimension Visitor Type mydata_2 <- read.csv("./data/dataset3.csv")
mydata_2$monthf <- factor(mydata_2$month,levels=as.character(1:12), labels=c("Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec"), ordered=TRUE)
# Map a color to Visitor Type Variable ggplot(mydata_2,aes(monthf,transactions,fill=visitorType)) + geom_bar(stat="identity") + facet_wrap(~medium,ncol=1)
# Stack the bar graphs side by side for easier comparison ggplot(mydata_2,aes(monthf,transactions,fill=visitorType)) + geom_bar(stat="identity",position="dodge") + facet_wrap(~medium,ncol=1)
# Strip the grey background and add a plot title ggplot(mydata_2,aes(monthf,transactions,fill=visitorType)) + geom_bar(stat="identity",position="dodge") + facet_wrap(~medium,ncol=1) + theme_bw() + ggtitle("MoM transactions split by Visitor Type")

If you followed the code correctly, you might end up with something like this:

There is a lot that can be still improved with the viz but let us stop here and quickly sum up what we just learnt. We understood the basic idea behind ggplot2, gained some knowledge about its terminology and saw how we could generate interesting visualizations in a matter of minutes. Of course, there is a fair bit of programming overhead involved but once you get the hang of ggplot2, it is time well spent in learning to code. If you’re in for something advanced you may want to have a look at our other blog posts on ggplot2 here

Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting the maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News. Google+

More Posts - Website

Follow Me:
TwitterFacebook