Skip to content

paolobietolini/gtm-template-boolean-conditions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Boolean Condition Template for Google Tag Manager

General Description

A flexible macro template for Boolean comparisons within Google Tag Manager, enabling conditional checks between variables.

Resources

GTM Community Template Gallery

Inputs

The template accepts three input parameters:

  • Input Variable: Variable to be evaluated
  • Condition: Type of comparison to execute
  • User Input: Value to compare against the variable

Supported Conditions

  • Equals
  • Does not equal
  • Contains
  • Does not contain
  • Starts with
  • Does not start with

Execution Flow

  1. Input Acquisition

    const inputA = data.inputVar;
    const inputB = data.inputUsr;
    const condition = data.condition;
  2. Conditional Evaluation Specific checks are performed based on the selected condition:

    • Direct equality comparison
    • Substring search
    • String start verification

Use Cases

  • URL filtering
  • Input validation
  • Conditional checks in tags and triggers

Usage Example

// Check if a URL contains a specific domain
const data = {
  inputVar: 'https://www.google.com',
  inputUsr: 'google',
  condition: 'contains'
};
// Returns: true

Important Notes

  • Supports string comparisons only
  • Case-sensitive
  • Always returns a Boolean value

License

Apache 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages