Container.FunctionCallMacroHandler

  • The Container.FunctionCallMacroHandler interface allows applications to define custom macros within Google Tag Manager.

  • Implementations of this interface must provide a getValue method, which calculates and returns the macro's value based on its name and parameters.

  • The getValue method receives the macro name and a map of parameters, supporting various data types like String, Double, Boolean, Map, and List.

  • The returned value from the getValue method can be a String, Boolean, Integer, Long, or Double, representing the calculated result of the custom macro.

public static interface Container.FunctionCallMacroHandler

Handler that is provided by the application to calculate the value of a custom macro.

Public Method Summary

abstract Object
getValue(String macroName, Map<String, Object> parameters)

Public Methods

public abstract Object getValue (String macroName, Map<String, Object> parameters)

Handler is given the macro name and a map of named parameters (the map may contain String, Double, Boolean, Map, or List values). It should return an object which is the calculated value of the macro.

The macroName is the same name by which the handler was registered. It's provided as a convenience to allow a single handler to be registered for multiple function call macros.

Returns
  • a String, Boolean, Integer, Long, or Double