isEqualTo — GTM Variable Template for Condition
isEqualTo EXTENDED Condition
Checks if the provided inputs are exactly equal, including case sensitivity. Returns true if identical, false otherwise. Primitive values only.
Examples
Equal strings
INPUT
Value To Compare: hello
Reference Value: hello
Reference Value: hello
OUTPUT
true
Different values
INPUT
Value To Compare: hello
Reference Value: Hello
Reference Value: Hello
OUTPUT
false
Strict type check
INPUT
Value To Compare: 42
Reference Value: 42
Reference Value: 42
OUTPUT
false
GTM Configuration
This is what you'll see when you open this variable in Google Tag Manager. Hover the icons for details.
isEqualTo
Value To Compare
💾 The value to compare.
Supported formats:
✓ Primitive value
Supported formats:
✓ Primitive value
Reference Value
🎯 Value to compare against. Case-sensitive, exact match required.
Supported formats:
✓ Primitive value
Supported formats:
✓ Primitive value
Input Setup
Input Function (optional)
⚙️ Optional pre-processing function applied to the input before internal logic (e.g., convert object to string, normalize case). Internal transformations such as case handling will still apply afterward.
Result Handling
Output Function (optional)
⚙️ Optional function to apply to the result before returning it (e.g., str => str + ' €', val => val !== undefined for boolean conversion). Useful for chaining transformations on the output.
Value To Compare string
💡 Type any text to see the result update live
🎯 Using special value — click input to type instead
Test with:
Falsy
Truthy
Reference Value string
🔗 Result Handling — Chain Variables
Chain apply-mode variables to the output. Each variable receives the result of the previous one.
isEqualTo()
Related Variables
Same category: Condition
Under the Hood
📜 View Implementation Code
/**
* Checks if the value is strictly equal to a reference value.
*
* @param {any} data.src - The value to check.
* @param {any} data.ref - The reference value to compare against.
* @param {Function|string} [data.out] - Optional output handler: function to transform result or string with format.
*
* Direct-mode specific parameters:
* @param {Function} [data.pre] - Optional pre-processor function to transform `src` before checking.
*
* @returns {boolean} True if the value is strictly equal to the reference, false otherwise.
*
* @framework ggLowCodeGTMKit
*/
const isEqualTo = function(value, reference) {
return value === reference;
};
const safeFunction = fn => typeof fn === 'function' ? fn : x => x;
const out = safeFunction(data.out);
// ===============================================================================
// isEqualTo - Direct mode
// ===============================================================================
const applyCast = (castFn, value) => safeFunction(castFn)(value);
const value = applyCast(data.pre, data.src);
return out(isEqualTo(value, data.ref));
// ===============================================================================
// isEqualTo(...) – Apply Mode
// ===============================================================================
/*
return function(value, reference) {
reference = data.rp1 ? data.ref : reference;
return out(isEqualTo(value, reference));
};
*/🧪 View Test Scenarios (5 tests)
✅ '[example] Equal strings'
✅ Equal numbers - should return true
✅ '[example] Different values'
✅ '[example] Strict type check'
✅ Both null - should return true