Project Description¶
When we structure a search engine marketing (SEM) account, one of the most important tasks is to match the right keywords with the right ads. We also need to make sure these ads send users to the most relevant landing pages.
In this project, we will practice how to automatically generate keywords for a search engine marketing campaign using Python. Our goal is to help send website visitors to the correct landing pages by using well-targeted keywords.
Let’s imagine we work for a digital marketing agency. The agency has been hired by a large online furniture retailer. Our challenge is to create a prototype campaign with keywords for the sofas section of their website.
The client wants us to create keywords for these products:
- sofas
- convertible sofas
- love seats
- recliners
- sofa beds
The client is a budget-friendly retailer who offers many promotions and discounts. Because of this, we will focus on keywords that highlight low prices and deals. We will avoid luxury or high-end keywords since the target customers are price sensitive. Because the client has a limited budget, it is important to create a tightly focused set of keywords. We will set all keywords to exact and phrase match types to improve relevance and manage costs effectively.
To begin, we need to generate a list of words that, combined with the products above, will create useful keywords. For example:
- Products: sofas, recliners
- Words: buy, prices
This will create keywords such as:
"buy sofas", "sofas buy", "buy recliners", "recliners buy", "prices sofas", "sofas prices", "prices recliners", "recliners prices".
At the end of this project, we want to create a DataFrame that looks like this:
Campaign | Ad Group | Keyword | Criterion Type |
---|---|---|---|
Campaign1 | AdGroup_1 | keyword 1a | Exact |
Campaign1 | AdGroup_1 | keyword 1b | Exact |
Campaign1 | AdGroup_2 | keyword 2a | Exact |
This table will help us organize the keywords into campaigns and ad groups. This organization will make it easier to launch and manage the marketing campaign successfully. nd manage the marketing campaign.
What keywords would help the client sell the listed products through search campaigns?¶
import pandas as pd
# List of words to pair with products
words = ['buy', 'price', 'discount', 'promotion', 'promo', 'shop']
products = ['sofas', 'convertible sofas', 'love seats', 'recliners', 'sofa beds']
# Create an empty list
keywords_list = []
# Loop through products
for product in products:
# Loop through words
for word in words:
# Append combinations
keywords_list.append([product, product + ' ' + word])
keywords_list.append([product, word + ' ' + product])
# Inspect keyword list
print(keywords_list)
[['sofas', 'sofas buy'], ['sofas', 'buy sofas'], ['sofas', 'sofas price'], ['sofas', 'price sofas'], ['sofas', 'sofas discount'], ['sofas', 'discount sofas'], ['sofas', 'sofas promotion'], ['sofas', 'promotion sofas'], ['sofas', 'sofas promo'], ['sofas', 'promo sofas'], ['sofas', 'sofas shop'], ['sofas', 'shop sofas'], ['convertible sofas', 'convertible sofas buy'], ['convertible sofas', 'buy convertible sofas'], ['convertible sofas', 'convertible sofas price'], ['convertible sofas', 'price convertible sofas'], ['convertible sofas', 'convertible sofas discount'], ['convertible sofas', 'discount convertible sofas'], ['convertible sofas', 'convertible sofas promotion'], ['convertible sofas', 'promotion convertible sofas'], ['convertible sofas', 'convertible sofas promo'], ['convertible sofas', 'promo convertible sofas'], ['convertible sofas', 'convertible sofas shop'], ['convertible sofas', 'shop convertible sofas'], ['love seats', 'love seats buy'], ['love seats', 'buy love seats'], ['love seats', 'love seats price'], ['love seats', 'price love seats'], ['love seats', 'love seats discount'], ['love seats', 'discount love seats'], ['love seats', 'love seats promotion'], ['love seats', 'promotion love seats'], ['love seats', 'love seats promo'], ['love seats', 'promo love seats'], ['love seats', 'love seats shop'], ['love seats', 'shop love seats'], ['recliners', 'recliners buy'], ['recliners', 'buy recliners'], ['recliners', 'recliners price'], ['recliners', 'price recliners'], ['recliners', 'recliners discount'], ['recliners', 'discount recliners'], ['recliners', 'recliners promotion'], ['recliners', 'promotion recliners'], ['recliners', 'recliners promo'], ['recliners', 'promo recliners'], ['recliners', 'recliners shop'], ['recliners', 'shop recliners'], ['sofa beds', 'sofa beds buy'], ['sofa beds', 'buy sofa beds'], ['sofa beds', 'sofa beds price'], ['sofa beds', 'price sofa beds'], ['sofa beds', 'sofa beds discount'], ['sofa beds', 'discount sofa beds'], ['sofa beds', 'sofa beds promotion'], ['sofa beds', 'promotion sofa beds'], ['sofa beds', 'sofa beds promo'], ['sofa beds', 'promo sofa beds'], ['sofa beds', 'sofa beds shop'], ['sofa beds', 'shop sofa beds']]
# Create a DataFrame from list
keywords_df = pd.DataFrame(keywords_list, columns=['Ad Group', 'Keyword'])
# Print the keywords DataFrame to explore it
print(keywords_df)
Ad Group Keyword 0 sofas sofas buy 1 sofas buy sofas 2 sofas sofas price 3 sofas price sofas 4 sofas sofas discount 5 sofas discount sofas 6 sofas sofas promotion 7 sofas promotion sofas 8 sofas sofas promo 9 sofas promo sofas 10 sofas sofas shop 11 sofas shop sofas 12 convertible sofas convertible sofas buy 13 convertible sofas buy convertible sofas 14 convertible sofas convertible sofas price 15 convertible sofas price convertible sofas 16 convertible sofas convertible sofas discount 17 convertible sofas discount convertible sofas 18 convertible sofas convertible sofas promotion 19 convertible sofas promotion convertible sofas 20 convertible sofas convertible sofas promo 21 convertible sofas promo convertible sofas 22 convertible sofas convertible sofas shop 23 convertible sofas shop convertible sofas 24 love seats love seats buy 25 love seats buy love seats 26 love seats love seats price 27 love seats price love seats 28 love seats love seats discount 29 love seats discount love seats 30 love seats love seats promotion 31 love seats promotion love seats 32 love seats love seats promo 33 love seats promo love seats 34 love seats love seats shop 35 love seats shop love seats 36 recliners recliners buy 37 recliners buy recliners 38 recliners recliners price 39 recliners price recliners 40 recliners recliners discount 41 recliners discount recliners 42 recliners recliners promotion 43 recliners promotion recliners 44 recliners recliners promo 45 recliners promo recliners 46 recliners recliners shop 47 recliners shop recliners 48 sofa beds sofa beds buy 49 sofa beds buy sofa beds 50 sofa beds sofa beds price 51 sofa beds price sofa beds 52 sofa beds sofa beds discount 53 sofa beds discount sofa beds 54 sofa beds sofa beds promotion 55 sofa beds promotion sofa beds 56 sofa beds sofa beds promo 57 sofa beds promo sofa beds 58 sofa beds sofa beds shop 59 sofa beds shop sofa beds
# Add a campaign column
keywords_df['Campaign'] = 'SEM_Sofas'
# Add a criterion type column
keywords_df['Criterion Type'] = 'Exact'
# Save the final keywords to a CSV file
keywords_df.to_csv('keywords.csv', index=False)