Advanced Configuration

To extend the functionality of Google Tag Manager, you can add Function Call variables and Function Call tags. Function Call variables let you capture the values returned by calls to pre-registered functions. Function Call tags let you execute pre-registered functions (e.g. to trigger hits for additional measurement and remarketing tools that are not currently supported with tag templates in Google Tag Manager).

Add custom tags and variables

To add a custom tag or custom variable with a Function Call:

  1. To create a custom tag, create a class that implements the TAGCustomFunction protocol:
    @implementation MYCustomTag<TAGCustomFunction>
    
    - (NSObject*)executeWithParameters:(NSDictionary*)parameters {
      // Add custom tag implementation here.
    }
    
    @end
    
  2. To create a custom variable, create a class that implements the TAGCustomFunction protocol:
    @implementation MYCustomVariable<TAGCustomFunction>
    
    - (NSObject*)executeWithParameters:(NSDictionary*)parameters {
      // Return the value of the custom variable.
      return @42;
    }
    
    @end
    
  3. Make sure the linker doesn't eliminate your class during link time optimization.
  4. In Google Tag Manager's web interface, use the class name to set up tags and variables.