Skip to content

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:

CampaignAd GroupKeywordCriterion Type
Campaign1AdGroup_1keyword 1aExact
Campaign1AdGroup_1keyword 1bExact
Campaign1AdGroup_2keyword 2aExact
import pandas as pd
products = ["sofas", "convertible sofas", "love seats", "recliners", "sofa beds"]
keywords = ["buy", "prices", "budget", "affordable", "discount", "cheap", "budget friendly", "on sale", "low cost", "best price", "with discount"]

def generate_keywords(products, keywords, match_type='Exact', campaign='SEM_Sofas'):
    col_names = ['Campaign', 'Ad Group', 'Keyword', 'Criterion Type']
    campaign_keywords = []
    
    for product in products:
        for word in keywords:
            keyword_d1 = product.lower() + ' ' + word
            keyword_d2 =  word + ' ' + product.lower()
            row_d1 = [campaign, # campaign name
                   product, # ad group name
                   keyword_d1, # search keyword
                   match_type] # keyword match type
            row_d2 = [campaign, # campaign name
                   product, # ad group name
                   keyword_d2, # search keyword
                   match_type] # keyword match type
            campaign_keywords.append(row_d1)
            campaign_keywords.append(row_d2)
                
    return pd.DataFrame.from_records(campaign_keywords, columns=col_names)

keywords_df = generate_keywords(products, keywords)
keywords_df.to_csv('keywords.csv', index=False)