Calculating conversion rate

In this exercise, you will practice calculating conversion rate, which is often the first metric you'll want to calculate when evaluating how a marketing campaign performed.

On marketing teams, conversion rate is typically the most important metric. It is one of the best ways to determine how effective a marketing team was at gaining new customers.

As a reminder, conversion rate is the percentage of the users who saw our marketing assets and subsequently became subscribers.

The formula for conversion rate is:

$$ \frac{\text{Number of people who convert}}{\text{Total number of people who we market to}} $$

This exercise is part of the course

Analyzing Marketing Campaigns with pandas

View Course

Exercise instructions

  • Calculate the number of unique user_ids in marketing DataFrame.
  • Calculate the number of people who subscribed using the converted column.
  • Calculate the conversion rate.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate the number of people we marketed to
total = ____

# Calculate the number of people who subscribed
subscribers = marketing[____]['user_id'].____

# Calculate the conversion rate
conversion_rate = ____
print(round(conversion_rate*100, 2), "%")