isNotURL β GTM Variable Template for Logic
When to Use This
Section titled βWhen to Use ThisβExamples
Section titled βExamplesβValid URL returns false
INPUT
Value To Check: https://www.example.com
OUTPUT
false
Invalid URL returns true
INPUT
Value To Check: not a url
OUTPUT
true
GTM Configuration
Section titled βGTM ConfigurationβThis is what you'll see when you open this variable in Google Tag Manager. Hover the icons for details.
Read-only Preview
isNotURL
Value To Check
πΎ The value to check.
Supported formats:
β All
Supported formats:
β All
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.
Related Variables
Section titled βRelated VariablesβSame category: Logic
Under the Hood
Section titled βUnder the Hoodβπ View Implementation Code
/** * Checks if the provided value is not a URL. * * @param {any} data.src - The value to check. * @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 not a URL, false otherwise. * * @framework ggLowCodeGTMKit */const parseUrl = require('parseUrl');const isNotURL = function(value) { return parseUrl(value) === undefined;};const safeFunction = fn => typeof fn === 'function' ? fn : x => x;const out = safeFunction(data.out);// ===============================================================================// isNotURL - Direct mode// ===============================================================================const applyCast = (castFn, value) => safeFunction(castFn)(value);const value = applyCast(data.pre, data.src);return out(isNotURL(value));// ===============================================================================// isNotURL() β Apply Mode// ===============================================================================/*return function(value) { return out(isNotURL(value));};*/π§ͺ View Test Scenarios (5 tests)
β
'[example] Valid URL returns false'β
'[example] Invalid URL returns true'β
Number - should return trueβ
Empty string - should return trueβ
Valid URL with path - should return false