values — GTM Variable Template for Object
Examples
Get object values
INPUT
Object To Process: {name: 'John', age: 30, city: 'Paris'}
OUTPUT
['John', 30, 'Paris']
Empty object returns empty
INPUT
Object To Process: {}
OUTPUT
[]
GTM Configuration
This is what you'll see when you open this variable in Google Tag Manager. Hover the icons for details.
values
Object To Process
💾 The object whose values are to be retrieved. If the input is not an object, it will be coerced to an object.
Supported formats:
✓ Object
✓ Any (will be coerced)
Supported formats:
✓ Object
✓ Any (will be coerced)
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.
Object To Process object
💡 Type any text to see the result update live
🎯 Using special value — click input to type instead
Test with:
Falsy
Truthy
🔗 Result Handling — Chain Variables
Chain apply-mode variables to the output. Each variable receives the result of the previous one.
values()
Related Variables
Same category: Object
Under the Hood
📜 View Implementation Code
/**
* Retrieves the values of an object.
*
* @param {Object} data.src - The object whose values are to be retrieved. If the input is not an object, it will be coerced to an object.
* @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 getting values.
*
* @returns {Array} An array of the values of the provided object.
*
* @framework ggLowCodeGTMKit
*/
const Object = require('Object');
const values = function(objectInput) {
return Object.values(objectInput);
};
const safeFunction = fn => typeof fn === 'function' ? fn : x => x;
const out = safeFunction(data.out);
// ===============================================================================
// values - Direct mode
// ===============================================================================
const applyCast = (castFn, value) => safeFunction(castFn)(value);
const value = applyCast(data.pre, data.src);
return out(values(value));
// ===============================================================================
// values() – Apply Mode: runtime parameter
// ===============================================================================
/*
return function(value) {
return out(values(value));
};
*/🧪 View Test Scenarios (10 tests)
✅ '[example] Get object values'
✅ '[example] Empty object returns empty'
✅ Object with array values - should return array of arrays
✅ Object with nested object values - should return array of nested objects
✅ Object with single property - should return array with single value
✅ Object with numeric keys - should return array of values
✅ String input - should return array of characters
✅ Array input - should return same array
✅ Number input - should return empty array
✅ Object with mixed value types - should return array of mixed types