Guide 106 · Container · GA4 + Tag Manager
Create a lookup table variable: map one value to another without a new tag per case
When the right value depends on the page — a different conversion ID for each thank-you page, a different label for each section — the naive fix is a tag per case. A lookup table does it in one variable: it reads an input variable, finds the matching row, and returns the output. Google's own worked example maps three thank-you pages to three conversion IDs: /thanks/buy1.html becomes 12345, /thanks/buy2.html becomes 34567, /thanks/buy3.html becomes 56789. This guide builds exactly that table.
After step 4, Preview mode shows the variable returning 12345 on the first thank-you page, 34567 on the second and 56789 on the third — three different outputs from one variable, with no extra tags.
Download the container fragment: the lookup table fragment (JSON) (export format version 2, 2121 bytes, MD5 e429ab0c2a66cd77c5f2884322e149db). It holds the Lookup - Conversion ID variable with Google's three example rows, and a GA4 event tag that reads it on the first thank-you page. The file is a hand-built import template, validated structurally — it was not exported from a live container.
What you need
- An input variable whose value differs per case. The worked example uses the Page URL, which Google's own example uses as the lookup input.
- The full list of input-to-output pairs. Write the table out before you build it: 3 rows in the worked example. A row added later is an edit to the variable, not a new tag.
- Edit access to the container. Creating a variable is a container edit.
The trace
- Go to Variables and click New under User-Defined Variables. The Variables page has two sections; user-defined variables are the lower one.
- Click Variable Configuration and choose Lookup Table. Lookup Table is listed under Utilities. Pick it and the configuration shows an input selector and an empty two-column table: When the selected variable equals on the left, Set this variable to on the right.
- Set the input to Page URL. Click the input selector and choose the Page URL built-in variable. The table will compare the current page's URL against each row, top to bottom, and return the output of the first row that matches.
- Add the three rows from Google's example. Row one: when the URL contains
/thanks/buy1.html, set the variable to12345. Row two:/thanks/buy2.htmlbecomes34567. Row three:/thanks/buy3.htmlbecomes56789. That is 3 rows, 3 distinct outputs, and 0 extra tags — the alternative was 3 tags with 3 triggers. - Name the variable after its function and click Save. Call it
Lookup - Conversion ID. A tag that needs the conversion ID references{{Lookup - Conversion ID}}and gets the right one for the page it fired on.
Dead ends
DEAD END — ROWS THAT MATCH MORE THAN ONE CASE. Rows are checked top to bottom and the first match wins. A broad row written above a narrow one — /thanks/ above /thanks/buy1.html — swallows every case below it. Order the rows from most specific to least specific.
DEAD END — NO ROW MATCHES AND NO DEFAULT. When no row matches, the variable returns nothing unless a default value is set. A tag that reads an empty conversion ID sends a broken value. Set a default, or make sure the table covers every page the tag can fire on.
DEAD END — A LOOKUP TABLE FOR A VALUE THAT NEEDS A PATTERN. A lookup table compares exact values, not patterns. Matching /page1.html through /page9.html would take 9 rows; a regex table does it in 3 patterns. That is the regex table guide.
End state
One variable, Lookup - Conversion ID, returning 12345, 34567 or 56789 depending on the thank-you page. The three cases live in one table, and adding a fourth thank-you page is one row, not a new tag and trigger.
Sources
- Tag Manager Help — User-defined variable types for web — lookup table type, the two-column table, the worked example mapping three thank-you pages to 12345, 34567 and 56789, Variables then New then Variable Configuration
Checked 11 November 2026. The click paths above are the ones in Google's help pages, opened 11 November 2026. No step in this guide was run inside a live Analytics property or a live Tag Manager container, because both need a Google sign-in and this site does not sign in as anyone. The container file was validated structurally instead: export format version 2, every tag's firing trigger resolves, every variable the tags reference exists in the file, and the tag types are the documented ones. Google moves menu items without warning; if a path on this page no longer matches, the linked help page is the current map. The container fragment for this guide is 2121 bytes (2.07 KB, 1.04% of the reported 200 KB container size limit), MD5 e429ab0c2a66cd77c5f2884322e149db, and passed 16 structural checks.