Imagine working for a digital marketing agency, and the agency is approached by a massive online furniture retailer. They want to test your skills at creating large campaigns for all of their website. You are tasked with creating a prototype set of keywords for search campaigns for their sofas section. The client says that they want you to generate keywords for the following products:
- sofas
- convertible sofas
- love seats
- recliners
- sofa beds
The client is a low-cost retailer, offering many promotions and discounts. You will need to focus on such keywords. You will also need to move away from luxury keywords and topics, as you are targeting price-sensitive customers. Because they are going to be tight on budget, it would be good to focus on a tightly targeted set of keywords and make sure they are all set to exact and phrase match.
Based on the brief above you will first need to generate a list of words, that together with the products given above would make for good keywords. Here are some examples:
- Products: sofas, recliners
- Words: buy, prices
The resulting keywords: 'buy sofas', 'sofas buy', 'buy recliners', 'recliners buy', 'prices sofas', 'sofas prices', 'prices recliners', 'recliners prices'.
As a final result, you want to have 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 |
import pandas as pd
# Start coding here
# Use as many cells as you need
Save at least 60 unique keywords as a DataFrame called keywords_df and a CSV file called keywords.csv.
1. Create pair words with products
# list of products
products = ['Sofas', 'Convertible sofas', 'Love seats', 'Recliners', 'Sofa beds']
# list of words
# On behalf of the brief above, there is a calculation to get the minimum length of the liste of words.
# Using two list of length 2 each, we end up with 8 couples of word, so the equation is like 2 * (n * m) = 8
# where n and m are the length of the two lists. we have to solve the equation 2 * (5 * m) = 60 where 5 is the length of the products list. which result in 6. so we have to have at least 6 words
words = ['Sale', 'Discounted', 'Special offer', 'Limited-time deals', 'Two for the price of one', 'Huge saving']
pairs = []
for val in products :
for i in range(len(words)):
keyword = val + ' ' + words[i]
keyword2 = words[i] + ' ' + val
if keyword not in pairs :
pairs.append(keyword)
pairs.append(keyword2)
# elif keyword2 not in pairs :
# display(pairs)
display(len(pairs))
prod = []
for val in pairs:
for el in products:
if el in val :
prod.append(el)
# display(prod)
display(len(prod))
keywords_df = pd.DataFrame({'Ad Group' : prod, 'Keyword' : pairs})
keywords_df.head()
keywords_df['Campaign'] = 'SEM_Sofas'
keywords_df['Criterion Type'] = 'Exact'
keywords_df.head()
# save to csv file
keywords_df.to_csv('keywords.csv', index=False)