Lookup tables and regex tables transform an input value into a selected output inside Google Tag Manager. They can simplify repeated mapping rules, such as converting a page category into a reporting label. Choose the table type that fits the pattern and document how unmatched inputs are handled.

Lookup tables map known values
A lookup table is useful when the input values are discrete and predictable. A page path, form ID, or campaign label can map to a standard category. Exact mappings are easy to inspect and maintain when the list is small and changes infrequently.
The main risk is an unlisted input. If the page path changes or a new form is added, the table may return a default or empty result. Add a deliberate default value and monitor whether new inputs appear.
Regex tables cover patterned values
A regex table can handle several inputs that share a stable pattern, such as multiple URLs under a defined section. It reduces repetitive rows when the pattern genuinely holds across the site. Poorly designed regular expressions can also match pages that were never intended to share a label.
Test representative positive and negative examples. Check the order and specificity of rules, especially where one pattern can overlap another. Keep complex expressions commented or documented for future editors.
- Use exact mappings for small, explicit lists.
- Use a regex only when the shared pattern is stable and testable.
- Set a safe default for unknown values and review it regularly.
Protect data quality
Mapping logic can hide naming inconsistencies instead of fixing them. Where possible, standardize the source value and use the table for a small, transparent transformation. Preview new and edge-case inputs before publishing so a convenient rule does not silently misclassify traffic.
Related guides
- GTM Built-In vs. User-Defined Variables: Which Should You Use?
- GTM Custom Event Trigger: Use dataLayer Events to Fire Tags
How did this article land?
Choose one reaction. You can change it anytime.
