Digital Marketing

Dynamic Keyword Insertion in Google Ads: How the {KeyWord} Code Works

Talha Aslan 19 min read

Short answer

What is dynamic keyword insertion, and what does the {KeyWord} code do?

Dynamic keyword insertion is a Google Ads feature that replaces a {KeyWord:default text} code in your ad text with the ad group keyword that triggered the ad. If the keyword does not fit or cannot be inserted, Google shows the default text inside the code instead. People often shorten it to DKI.

Keep reading for the full details and examples

For example, you usually meet this code in an ad someone else built, or on a recommendation screen. The curly braces, the colon, and the odd capital letters look like an error at first. The questions that follow are predictable: what does this code mean, what does my ad look like to the searcher, and should I keep using it? This guide answers them in order.

We see the code often in account audits. Sometimes it does its job well; sometimes it quietly produces strange headlines nobody noticed. So first, we look at the official definition and syntax. Then we cover capitalization, default text, character limits, risks, and the cases where you should not use it.

Where does this feature appear in the Google Ads interface?

Google's Help Center calls the feature "keyword insertion." Advertisers more often say "dynamic keyword insertion" or simply DKI. In other words, both names describe the same function. Google's page on setting up keyword insertion for your ad text describes two ways to set it up.

  • Guided method: you type a curly brace in the ad text field, pick keyword insertion from the list, enter default text, and choose a capitalization style.
  • Manual method: you type the code straight into the text and set capitalization through the way you write the word "keyword" inside the code.

The guided method offers three capitalization options: Title case, Sentence case, and Lower case. The manual method allows five formats, which we cover in a table below.

Menu labels in Google Ads change from time to time. So if you see a different label on your screen, focus on the function. The insertion list that opens when you type a curly brace in a text field is the entry point to this feature.

What is the syntax of the dynamic keyword insertion code?

First, the code has three parts: curly braces, the word "keyword," and the default text after a colon. For example, if you write {KeyWord:Furnace Repair} in a headline, Google tries to replace it with a matching keyword from the ad group. If it cannot, it shows "Furnace Repair."

  1. Curly braces: they open and close the code. If one is missing, the code fails.
  2. The word keyword: it marks where the keyword goes and sets the capitalization format.
  3. Colon and default text: the fallback phrase that appears when no keyword can be inserted.

You can use the code as the whole headline or place it inside a phrase. For instance, "{KeyWord:Furnace Repair} Today" works as a headline. In that case, however, make sure both the default text and your longest keyword read naturally in the phrase.

The official page also asks you to keep the default text short enough to stay within the character limits. We cover that separately below, because most errors start right there.

What do the capitalization variations change?

How you write the word "keyword" inside the code decides which letters of the inserted keyword appear in capitals. Google's official table defines five formats. Below, we summarize them with our own example keyword, "furnace repair usa."

Code formatRuleExample display
{keyword:...}All letters lowercasefurnace repair usa
{Keyword:...}Only the first letter of the first word capitalizedFurnace repair usa
{KeyWord:...}First letter of every word capitalizedFurnace Repair Usa
{KEYWord:...}First word in capitals, other words title caseFURNACE Repair Usa
{KeyWORD:...}Title case, with the last word in capitalsFurnace Repair USA

In Google's own examples, the last two formats exist mainly to display abbreviations such as "USA" correctly. For most ads, {KeyWord:...} or {Keyword:...} is enough. Words in full capitals can run into editorial rules; we cover that in our post on editorial disapprovals and capitalization.

Also note that a small slip in the code, such as {keyWord:...}, is not one of the five valid formats. If you type the code by hand, check the format against the table.

When you choose a format, look at the rest of the headline. If the other words follow title case, {KeyWord:...} keeps the look consistent. In description lines, sentence case reads more naturally, so {Keyword:...} or {keyword:...} often works better there. In short, the format is a readability choice, not just a style preference.

What does default text do, and how should you choose it?

Put simply, default text is the safety net of the code. Google shows it when it cannot insert the keyword, for example when the keyword is too long. In other words, part of your ad may always run with the default text instead.

Therefore, write the default text as a real headline fragment, not filler. Good default text has three traits:

  • It is short: it leaves room for other words within the character limit.
  • It is broad but not empty: it covers the shared theme of every keyword in the ad group.
  • It fits the phrase: it reads well with the words before and after the code.

For example, if your ad group holds keywords like furnace repair, furnace maintenance, and furnace not heating, "Furnace Repair" is a sensible default. By contrast, a catch-all phrase like "Our Services" tells the searcher nothing.

Finally, revisit the default text whenever the ad group changes. In ads copied from older campaigns, the default text often keeps describing the old product.

What happens when a keyword is longer than the character limit?

According to Google's Help page, if a keyword is too long to fit in the ad, Google uses the default text instead. In the official example, a long keyword like "gourmet chocolate truffles" does not fit the headline, so the ad shows the default text. The code does not cut the keyword; it falls back to the default text entirely.

The same setup page states the limits: 30 characters per headline, 90 per description line, and 15 per display path field. Google can change these values, so check the current figures on the official page before an important campaign. When you count, the inserted text counts, not the code itself.

In practice, this means that if your headline has other words next to the code, long keywords never show. For instance, in "{KeyWord:Furnace Repair} Open 7 Days," a long keyword will not fit, so the default text appears every time.

Instead of counting by hand, you can try our responsive search ad builder. It counts characters as you type headlines and descriptions. For codes, it counts the default text, and it flags any capitalization format outside the five valid ones as an error. As a result, you can see which headline sits near the limit before it goes live.

With dynamic keyword insertion, does the ad show the search term or the keyword?

The ad shows the keyword, not the search term. Google's page about keyword insertion says the feature works the same way across all match types, and the ad shows the keyword rather than the user's search term. That lets you predict the final ad text.

Also, this fact corrects a common misreading. Many advertisers believe the code pastes whatever the user typed into the ad, so they either fear it or trust it too much. In reality, only keywords you added can appear in your ad.

Still, match type plays an indirect role. A broad match keyword can trigger on very different searches. In that case, the keyword shown in the ad may sit far from what the user wanted. We cover that risk in broad match risks, and the more controlled option in our exact match guide.

The official setup page adds one more detail: Google corrects misspelled keywords or replaces them with default text. So you do not need to add misspelled variants. If your keyword list is messy and you cannot predict how each keyword will look in the ad, our google ads account management work treats keyword structure and ad copy together.

Where can you use the {KeyWord} code, and where can't you?

The official setup page says the code works in headlines, description lines, and display path fields. However, it states clearly that customizers cannot go in the Final URL field. So you cannot place the code inside the page address.

Field or caseDoes the code work?What to watch
HeadlineYesThe character limit is tightest here.
DescriptionYesCheck that the sentence still reads well.
Display pathYesShort limit and the special character warning apply.
Final URLNoThe address must stay fixed.
Dynamic Search AdsNoPer the official page, the default text appears in the description.
Restricted content categoriesNoThe official page does not permit it for healthcare or sexual content.

For the display path and landing page URL, the official page also advises avoiding special characters such as "é." Keep that in mind if your keywords contain accented letters.

Dynamic Search Ads already build headlines from page content on their own; you can read how that format works in what are Dynamic Search Ads.

Example scenario: how does one ad look across different keywords?

The table below is an example scenario. Assume a heating repair company has four keywords in an ad group and the headline "{KeyWord:Furnace Repair} Same Day." The headline limit is 30 characters; " Same Day" takes 9 characters including the space, so 21 characters remain for the keyword.

Triggering keywordCharactersHeadline shownNote
furnace repair14Furnace Repair Same DayFits and reads naturally.
furnace service15Furnace Service Same DayFits and reads naturally.
gas furnace repair18Gas Furnace Repair Same DayFits, but close to the limit.
why is my furnace not heating29Furnace Repair Same DayDoes not fit; default text shows.

To see this table with your own keywords, open the google ads ad preview tool. Type the code in a headline field, paste your ad group keywords into the keyword box, and turn on the option to insert the first keyword in the preview. If the first keyword fits, the tool shows it in your chosen capitalization; if not, it falls back to the default text.

The last row teaches an important lesson: long, question-style keywords do not work well with the code. Either move them to a separate ad group or give them hand-written headlines without the code.

What is the trademark and brand name risk?

The most sensitive side of the code appears when your ad group contains another company's brand name. The official setup page states that restricted trademarks will not insert into ad text. In that case, Google shows the default text instead of the keyword.

That protection does not solve every case, though. Using a competitor's brand as a keyword and showing that name in your ad text are separate issues. The code can blur the line between them. So we recommend not using the code in ad groups that contain competitor brand keywords.

  • Competitor brand keywords: run them in a separate ad group with neutral copy and no code.
  • Reseller or authorized dealer: first confirm whether you have permission to show the brand name.
  • Your own brand: the code is usually fine on your own brand keywords, but check the spelling.

We cover the legal and policy side of bidding on competitor names in is it legal to bid on competitor brand names. This section is not legal advice; for trademark questions, talk to a qualified attorney.

What are the grammar, spelling, and awkward headline risks?

The most common problem the code creates is awkward grammar. The words around the code must work with every keyword in the group. For example, "Get Your {KeyWord:Furnace} Fixed" breaks when the keyword "furnace maintenance" arrives.

So place the code where any keyword fits. Either let the headline consist of the code alone, or follow the code with a standalone phrase. "Furnace Repair Same Day" works well; "Book a Furnace Repair Tech" does not work with every keyword.

  1. Articles and plurals: "a" versus "an," or singular versus plural keywords, can break the phrase.
  2. Repetition: a structure like "{KeyWord:Repair} Repair" doubles the word when the keyword already says "repair."
  3. Odd word order: keywords like "furnace repair near me cheap" match searches but read badly in a headline.
  4. Capitalization: brand names and abbreviations may need a specific format.

The official page also stresses that ads must still comply with policy after the keyword is inserted. In particular, if you applied recommended keywords with one click, checking how those new keywords look in the ad is your responsibility.

When should you not use dynamic keyword insertion?

However, the code does not suit every ad group. In the following cases, hand-written headlines are usually safer.

  • Mixed ad groups: if you grouped different services together, the code can produce irrelevant headlines.
  • Long or question-style keywords: they never fit, so the default text always shows and the code does nothing.
  • Competitor brand keywords: because of the trademark risk described above.
  • Groups heavy on broad match: the gap between the shown keyword and search intent can grow.
  • Restricted categories: content types the official page does not permit.
  • Headlines that need a fixed message: legal text or a company slogan should not change.

What these cases share is that the code takes control away from you. The cost of losing control can be a lower click-through rate, or it can be a misleading promise shown to a searcher. So use the code as a deliberate choice, not as a default.

Does dynamic keyword insertion raise Quality Score?

Google's documentation does not say the code raises Quality Score directly. So we make no claim like "use DKI and your Quality Score will rise." The effect is indirect: the code can tighten the match between ad text and the search, but that match is not automatic.

Quality Score rests on components such as expected click-through rate, ad relevance, and landing page experience. By showing the keyword, the code can support ad relevance. On the other hand, broken or awkward headlines can lower click-through rate and erase that gain.

In short, the code can be a relevance aid, but it does not replace a well-built ad group. The lasting way to improve relevance is to group close keywords together and write fitting headlines for them by hand. We explain the components of Quality Score and how to read them in our Quality Score guide.

Also, in responsive search ads, including keywords in some headlines is already a recommended practice. Using the code in one or two of those headlines leaves room for benefit and offer messages in the rest.

What are the most common dynamic keyword insertion mistakes?

Most mistakes we find in account audits fit a few patterns. You can use this list when you check your own ads.

  1. Empty or overly long default text: leaves the code either broken or useless.
  2. Invalid capitalization format: anything outside the five formats will not behave as expected.
  3. Using the code in every headline: removes variety from a responsive search ad.
  4. Placing it where grammar depends on the keyword: produces broken phrases.
  5. Ignoring negative keywords: a keyword triggered by irrelevant searches also looks irrelevant in the ad; see our negative keywords guide.
  6. Never checking after launch: not looking at how newly added keywords appear in the ad.

Fortunately, you can catch most of these mistakes before launch. After you write the code, think through each keyword in the ad group and ask how the headline reads with it.

How is DKI different from IF functions, ad customizers, and DSA?

All four features change ad text automatically, so people mix them up because they look alike. However, each draws on a different source and answers a different question.

FeatureWhat changes the text?Typical useControl level
Dynamic keyword insertionThe ad group keyword that triggered the adShowing the searched service in the headlineMedium; as controlled as your keyword list
IF functionConditions such as device or audienceA different call to action on mobileHigh; you write every version
Ad customizerValues you enter (price, date, text)Prices, stock, countdownsHigh; you manage the values
Dynamic Search AdYour site's page contentLarge product or service catalogsLow; Google writes the headline

We do not repeat the IF function here; you can see how it works in our post on the Google Ads IF function. The core idea: DKI reacts to the keyword, IF reacts to a condition, customizers react to your data, and DSA reacts to your page.

How does the code work with pinning and Ad Strength?

In responsive search ads, a headline with the code appears in different combinations with your other headlines. So you may want to control which position it takes. Pinning does that, but every pin reduces the ad's flexibility.

So our practical advice: have a real reason before you pin a headline with the code. For instance, if you want the service name in the first position of every ad, pinning that headline to position one can make sense. We weigh the pros and cons in our post on pinning headlines.

Ad Strength, in turn, looks at headline variety and keyword relevance. Headlines with the code can help relevance, but filling every headline with it lowers variety. You can learn how to read the indicator in our Ad Strength guide.

Also, if you want to sort your keyword list into match types before adding it to the ad group, the keyword match type tool wraps keywords in broad, phrase, and exact match. A clean list makes the keywords the code will show more predictable as well.

Step by step: how do you set up your first dynamic keyword insertion ad?

Next, the steps below give a safe order for anyone using the code for the first time. Each step aims to surface possible errors before launch.

  1. Pick the ad group: choose a group of very close keywords.
  2. Check keyword lengths: see whether the longest keyword fits the headline limit.
  3. Write the default text: choose a short phrase that covers every keyword in the group.
  4. Choose the capitalization format: for most ads, {KeyWord:...} is enough.
  5. Use the code in only one or two headlines: keep other headlines for benefit and offer messages.
  6. Preview: check how the headline reads with each keyword.
  7. Monitor after launch: look at the ads and search terms reports in the first weeks.

For example, a carpet cleaning company could start with "carpet cleaning," "carpet cleaning prices," and "home carpet cleaning." All three are short and describe the same service.

When you follow this order, you avoid most of the code's biggest risks: overflow, broken phrases, and irrelevant display. Still, do not set it and forget it; repeat the same checks whenever you add new keywords to the group.

How do you read dynamic keyword insertion performance in reports?

After launch, two reports show whether the code does its job: the ads report and the search terms report. The ads report shows click-through rate and conversions for the ad with the code. The search terms report shows which searches triggered which keyword, which tells you indirectly which keyword appeared in the ad.

Then, while reading, look for answers to three questions:

  • How often does the default text run? If long keywords dominate, your ad may mostly show the default text.
  • Do triggered keywords fit search intent? Add negative keywords for searches that do not.
  • Does the headline with the code beat the others? Asset reports in responsive search ads can give you a clue.

The key is not to decide on a single week of data. The benefit of the code shows as keyword variety grows. So look at several weeks of data, and try not to make other big changes in the same period.

Decision list: should you use the code?

Let us turn everything above into a short decision list. Think about your own ad group and find the line that fits.

  • The group is small and the keywords are very close: you can use the code in one or two headlines.
  • The group mixes different services: split the group first, then consider the code.
  • Keywords are long or question-style: use hand-written headlines instead.
  • The group holds competitor brand keywords: do not use the code.
  • The code is already live, but nobody checks it: preview the headline with each keyword and fix broken ones.

In practice, the right answer on this list is often "partly." Think of the code not as an engine that carries the whole ad, but as a small helper on top of a well-built ad group.

Who should review your ad copy on a regular basis?

Specifically, writing the dynamic keyword insertion code correctly takes a few minutes. The real work is keeping the keyword list, match types, negative keywords, and landing page aligned. When one of those pieces drifts, the code starts producing odd or irrelevant headlines in places you do not notice.

If you cannot run this review yourself, ppc management services can take it off your plate. Our team first audits account structure, match types, negative keywords, and conversion tracking. Then we build ad copy that matches the landing page and refine it every week based on data. Campaigns run in your own account, and you can see openly which change was made and why.

If you manage your own account, the steps and decision list in this guide give you a safe start. However, as the number of ad groups grows, previewing every keyword by hand gets harder. At that point, a steady review routine is the shortest way to keep the code useful.

Core guide: What Is Digital Marketing? Its types, examples and how it is done, on one page with an interactive film that travels through the brain.

Frequently Asked Questions

How do you write the dynamic keyword insertion code?
You write it in curly braces with the word "keyword," a colon, and default text, for example {KeyWord:Furnace Repair}. Google replaces the code with the keyword that triggered the ad. If the keyword does not fit or cannot be inserted, it shows the default text instead. The way you capitalize the word "keyword" sets the display format.
Does the ad show the user's search term?
No. The ad shows the keyword from your ad group, not the user's search term, and Google applies this the same way across all match types. That means you can predict the final ad from your keyword list. Still, with broad match, the triggered keyword may sit far from the search intent, so watch your search terms report closely.
When does the default text appear?
Default text appears whenever Google cannot insert the keyword into the ad. The most common reason is that the keyword is too long for the character limit. Restricted trademarks and some misspelled keywords also lead to default text. So write the default text as a meaningful headline fragment on its own, not as filler.
Does the {KeyWord} code work in the Final URL?
No. Google's official setup page states that customizers cannot be used in the Final URL field. You can use the code in headlines, description lines, and display path fields. The page also advises avoiding special characters such as accented letters in the display path and landing page URL, so check keywords that contain them.
Can dynamic keyword insertion make my ad read badly?
Yes, if you place it carelessly. The words around the code must work with every keyword in the ad group. Articles, plurals, and repeated words often break the phrase. Use the code alone or follow it with a standalone phrase, and preview the headline with each keyword before launch. Long, question-style keywords are best kept out of the group.
Is it a good idea to use the code in every headline?
No. If every headline in a responsive search ad uses the code, the ad loses variety and Google keeps building similar combinations. Use the code in one or two headlines, and keep the rest for benefit, offer, and trust messages. That way you balance relevance and variety, which also helps your Ad Strength feedback.
  • dynamic keyword insertion
  • keyword insertion code
  • what is DKI
  • responsive search ads
  • google ads ad copy
  • default text
  • google ads headlines
Share:
Talha Aslan

Google Partner digital marketing expert. Hands-on with SEO, Google Ads, web design and e-commerce projects since 2012; every post here comes from that experience.

Next project

Get a quote for your project.

Your brief goes straight to Talha Aslan and team: strategy led by Talha, delivery by an experienced team. We reply the same day and send the scope, timeline and price as a written quote within 1 business day.