NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > R Shiny > Using R Shiny for Geo-Analysis, Low Engagement Insights, & Benchmarking

Using R Shiny for Geo-Analysis, Low Engagement Insights, & Benchmarking

Debbie Trinh
Posted on Apr 9, 2023

Have you ever wondered when a brand shifts from simply being a product to a recurring part of your routine?  Marketing plays an important role in this process of acquiring and retaining customers, and analyzing the impact of marketing campaigns through marketing attribution is key to enhancing marketing strategies. This applies not only to individuals but also to loyal customers. In this project, I utilized the Starbucks Rewards dataset from Kaggle and Starbucks storesโ€™ location data from aggdata.com as of March 2023 to build an R Shiny app that provides comprehensive insights into Starbucks' marketing attribution metrics. Additionally, I will dive into three new insights in more detail: low engagement users, offer time analysis, and the utilization of geo-based data for business expansion strategy.

 

Data Overview and Preparation

Starbucks Marketing Dataset:

The Starbucks reward offers dataset bundle from Kaggle simulates the Starbucks Reward Program and includes 76,277 marketing offers sent to 17,000 users by offer type variant and channel during a 30-day test period.

The dataset is composed of three tables: an event log that tracks user actions such as marketing offers received, viewed, completed, and transactions; user profiles that include age, gender, income, and the date they became a member; and types of reward variants that were sent to users through different channels.

Starbucks Location Dataset:

To identify potential locations for store expansion, I created a heatmap of existing Starbucks locations using data from aggdata.com, a highly regarded source for location data. The dataset contains information on 17,280 Starbucks locations as of March 1st, 2023, across four countries, including the United States, Canada, Puerto Rico, and Mexico. It includes details such as store name, address, city, state, zip code, latitude, and longitude coordinates, as well as other relevant geographic features.

Starbucks Competitors Dataset:

To obtain real-time data on Starbucks' competitors in PA, NJ, and NY, I pull from the Yelp API with a call limit of 1,000 per unique location searched. The results for each state are aggregated together after being retrieved. Due to concerns about the map's loading speed, I do not collect data for all 50 states. For this analysis, I classify businesses that serve coffee or tea and have a Yelp rating of 3.5 or higher as Starbucks' competitors, which is consistent with Starbucks' own rating on Yelp.

Using Python, I joined the Starbucks reward offers dataset bundle and leveraged ChatGPT to write transformations, create visualizations in R, and collaborate on editing this post.

 

Application

Marketing Attribution R Shiny App

 

Looking Back: Recap of Three Key Insights from Project I

Let's quickly recap the top three insights from the first project, which include Marketing Offer Ranking, Cohort Analysis, and Response Rates.

  1. Marketing Offer Ranking

The Marketing Offer Ranking leaderboard provides a clear ranking of the marketing offers from highest to lowest response rates and enables users to filter on offer type to reveal that higher duration offers perform better than lower duration offers for both BOGO and discount categories.

  1. Cohort Analysis

Cohorts are segmented based on Starbucks members signup year. This tab compares the total spending in dollars by member signup year with the Average Spend per Member Sign Up Year. This analysis highlights that the 2017 cohort had the highest total spending, and the 2016 cohort had the highest average spend per member.

  1. Response Rates

Response rates are calculated by dividing the number of offers completed by the number of offers received. The dashboard highlights that response rates increase with age and income, and that females are more responsive than males to marketing offers. By including age group, gender, and income group dropdowns, users can easily explore trends within specific segments of interest.

 

Analyzing User Behavior and Geographical Trends: New Insights for Starbucks' Future Success

Now, let's shift the focus to three new insights:

  1. Identifying low engagement users based on purchasing below the average order value
  2. Analyzing the time distribution between receiving a marketing offer and making a transaction
  3. Incorporating geo-based data in selecting the next Starbucks store location

These insights were chosen for their relevance to business success and the need to stay competitive in the market. The first insight proposes a strategy to increase engagement and retention among low engagement users, while the second insight provides a benchmark for measuring the effectiveness of marketing offers or whether new users are exhibiting positive responses. Finally, the third insight explores a geo-based strategy for store expansion to meet customer demand.

 

Insight 1: Low Engagement Users

(How to continue maintaining revenue)

It's important to prioritize customer retention as much as new user acquisition, as they both have potential to generate revenue. In the first project, we looked at active versus inactive members.  Active members spent at least some money during the 30-day test period when inactive members spent none.  This time, I'd like to focus on low engagement users โ€“ the ones who do spend some money but less than  the average order value.

During the 30-day test period, the average order value was $12.78, calculated by dividing the sum of transactions by the count of transactions. There were 1,993 users who spent less than the average order value, which we'll define as low engagement users.

To incentivize them, we can consider introducing them to new products they may not have tried before, such as limited-time seasonal items or exclusive merchandise. We could also reward them with bonus stars for trying something new. By targeting this group, we can improve their engagement and retention over time.

Insight 2: Time Distribution Between Offer Received and Transaction by User

(How to increase revenue through benchmarking)

In this insight, I will focus on benchmarking to increase revenue by analyzing the time between when a user receives a marketing offer and when they complete a transaction. This metric provides a baseline for the average time it takes for a marketing offer to influence user behavior in a way that positively impacts revenue.

Based on this analysis, it appears that the average time is approximately three days, with a right-skewed distribution indicating that a significant proportion of users make a transaction within one to three days after receiving an offer. From this insight, it is recommended to wait for at least three days before assessing their effectiveness. Additionally, it is advisable to avoid overwhelming customers with too many offers by sending them an offer less than once every three days.

Insight 3: US Starbucks Heatmap as of March 2023

(How to expand the business)

Summarizing the latest SEC 10-K Filing from November 2022, Starbucks' financial results and long-term growth model will be driven by new store openings, comparable store sales, and margin management. The company typically locates its company-operated stores in high-traffic, high-visibility locations and can vary the size and arrangement of its stores to cater to different settings, including downtown and suburban retail centers, office buildings, university campuses, and rural and off-highway locations. Starbucks is expanding its store locations, focusing on drive-thru formats that provide greater access and convenience, as well as alternative store set up that offer a more streamlined customer experience in dense metropolitan areas.

Because Starbucks is a mature US company, it plans to grow strategically by expanding into new locations while closing some unprofitable locations. The company has also shifted its store expansion strategy from community building to convenience to boost growth and increase revenue by 10% to 12% over the next few years. The plan for the next two years includes 35% drive-thru only stores, 14% pickup-only stores, and 5% delivery, while cafes will make up only 2% of all store openings.

 

With this context, the business question to answer is: where to open the next Starbucks store?

There are important factors to consider when identifying new locations for expansion The first step is to analyze the concentration of existing Starbucks stores in different areas. In Philadelphia, the heatmap shows that Starbucks stores are currently clustered around City Hall, Center City downtown, and University City, where major universities such as Drexel and the University of Pennsylvania are located.

To ensure success, Starbucks aims to balance brand recognition and consumer demand when selecting new store locations, while also avoiding cannibalizing sales from existing stores. To achieve this, Starbucks often partners with local businesses and real estate developers to secure prime locations and gain insights into local market conditions. For example, Starbucks has positioned one of its stores at Broad and Washington where residential and commercial real estate construction is underway.

Accessibility is another key consideration for store location. In Philadelphia, for example, Starbucks strategically places its stores near subway stations to make them easily accessible for commuters. In fact, the latest Starbucks growth strategy includes opening its first Philadelphia pickup only format downtown at 1709 Chestnut. This store will be for takeout only and will not have public seating or bathrooms, a store format intended to cater specifically to people on-the-go, such as working professionals and commuters. The store's location in a high foot traffic area, with multiple nearby hotels, further reinforces its appeal to locals and visitors alike looking for a convenient spot to grab their coffee.

 

Decision-making Process for Choosing the Next Starbucks Store Location

When considering where to place the next Starbucks store, I initially thought about placing it near the stadiums where Philadelphia's sports teams (Eagles, Flyers, Sixers, Phillies) play, as well as in the up-and-coming neighborhood of Point Breeze. However, I reconsidered these locations since the stadiums only have games a few times a week. Also, Point Breeze already has direct competition from Batter and Crumbs (also known as the Vegan Starbucks) which opened in 2018.

Ultimately, during a leisurely stroll to the University of Pennsylvania, I found a potential location by the 24th and Chestnut luxury apartments. This location offers high visibility unobstructed by buildings. Situated near a Megabus stop and right off a highway entrance/exit, a take-out, pick-up only store could be a good fit for commuters. It is adjacent to the Schuylkill River Trail, a popular running path for athletes and a convenient refueling spot for those after a workout. In addition, it is close to the Schuylkill Banks, which hosts group yoga, picnics, and summer outdoor movie screenings, making it a potentially high-foot-traffic area.

Overall, opening a Starbucks by Philadelphiaโ€™s 24th and Chestnut luxury apartments could potentially be a lucrative location with high foot traffic and convenient accessibility for commuters and fitness enthusiasts. Starbucks could partner with the real estate management and local businesses in the area to gain insight into the local market conditions and confirm the practicality of opening a store in this location.

 

Recap and Recommendation

In summary, the three insights for Starbucks strategy are:

  1. Low engagement users should be prioritized as a retention strategy. An approach is to encourage and incentivize them to try new products or seasonal food and beverages (such as the Paradise Drink or Kale and Mushroom Egg Bites), which can help them discover and appreciate the range of offerings that Starbucks provides.
  2. The average time between receiving a marketing offer and making a purchase is approximately three days, with a good proportion of actions taking place between 1-3 days. This finding suggests that it is best to wait for a minimum of three days before evaluating the effectiveness of marketing offers. Moreover, to prevent customers from being overwhelmed with excessive offers, it is recommended to send offers no more than once every three days.
  3. Starbucks is prioritizing the expansion of its store locations with a focus on drive-thrus, pick-up, and delivery options over the next two years. The company is targeting areas with high customer accessibility and convenience. I recommend a new store location by 24th and Chestnut with high foot traffic and convenient accessibility for commuters and fitness enthusiasts, who may be content with a take-out only store setup. Starbucks can partner with local real estate development to validate if this is a practical and potentially lucrative venture.

 

Future Work to Enhance R Shiny

If more time were available, here are some features that we could implement to improve the R Shiny dashboard.

  1. A slider could be added to the member pie chart to enable users to dynamically adjust the transaction value that defines low engagement. Currently, low engagement users are defined as users that spend less than an Average Order Value of $12.78, but the slider would allow users to explore how changing this value affects the number and percentage of low-engagement users.
  2. Another potential enhancement would be to add a gender and/or age segment dropdown to the average time between offer received and transaction visualization, which would allow users to investigate whether the average time varies by demographic category.
  3. To enhance the existing Starbucks heatmap and identify neighborhoods that may be receptive to the new take-out-only store model, US census data on population density, growth, and other indicators of promising locations can be overlaid onto it. Furthermore, incorporating Yelp data can assist in identifying areas with existing business competition, such as bakeries and coffee shops, which can help determine whether a new Starbucks store should be built in that area.

 

In conclusion, this is part II of this project, which presents comprehensive marketing attribution metrics through an R Shiny dashboard to help business leaders focus on strategy and outcomes. The next steps are to overlay US Census and Yelp data onto the existing heatmap using their respective APIs. Stay tuned!

About Author

Debbie Trinh

Debbie is a strategic-minded data science professional, with experience growing digital products that solve complex problems. She enjoys iterating to uncover impactful features that enhance the user experience and drive adoption in marketing strategy. Debbie has earned a...
View all posts by Debbie Trinh >

Leave a Comment

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application