Generating an ecommerce glossary with AI.

By Filippo Conforti on June 13, 2023

Last week, I decided to run an experiment using ChatGPT and create an ecommerce glossary on this publication. So I signed up for an account with OpenAI, put down a list of about 60 ecommerce terms, and coded a script to generate a markdown document for each term, using this prompt:

Write a markdown document with a detailed description of what #{term} is.

I then wrote another piece of code to programmatically create a glossary page for each of the generated documents. I completed the entire job in less than two hours, starting from zero. Below is a screenshot of the result, which can be viewed live here.

AI-generated ecommerce glossary page.
AI-generated ecommerce glossary page.

Why I did it

The idea of creating and maintaining an ecommerce glossary has always been in my head. The terms I use in my articles may not be familiar to everyone, and a quick refresher can be helpful even for the most experienced readers.

Nonetheless, manually generating a glossary can be quite time-consuming, and I'm not confident I can add much more value than what can be found on Wikipedia, for example.

While ChatGPT's descriptions are not perfect, they are good enough and can be automated. By using this mechanism, I can add new terms to the glossary almost instantly and review them manually whenever necessary.

Another reason why an ecommerce glossary may be useful is SEO. As part of the experiment, I want to see if publishing those terms on my website will help me rank for more keywords and get more organic traffic. I'm not sure whether Google will "understand" that those pages have been generated with AI and not rank them, or even penalize this website!

Let's hope not. Anyhow, I'll monitor those keywords and share the results in a few months. The impact of AI on SEO and ecommerce can be huge, but I have more questions than answers. As an engineer, I don't know any better way to get answers than by collecting real data and analyzing it.

The OpenAI script

Here is the Ruby script I used to generate the documents in case you want to try something similar.

require 'openapi'
require 'yaml'

API_KEY = "YOUR-ADMIN-OPENAPI-KEY"
client = OpenAI::Client.new(access_token: API_KEY)

terms = YAML.load_file('terms.yml')

terms.each do |term|
  puts "Generating #{term}..."
  response = client.chat(
      parameters: {
          model: "gpt-3.5-turbo",
          messages: [
            {
              role: "user",
              content: "Write a markdown document with a detailed description of what #{term} is."
            }
          ],
        }
      )
  text = response.dig("choices", 0, "message", "content")
  slug = term.downcase.strip.gsub(' ', '-')
  File.write("./output/#{slug}.md", text)
end

As you can see, it's pretty simple and can be easily translated into any programming language of your choice.

Enjoy the reading?

Subscribe to the newsletter and get a new article delivered to your inbox every week.