Container.FunctionCallMacroCallback
Callback that is provided by the application to calculate the value of a custom macro.
Public Method Summary
abstract Object
|
getValue( String
functionName, Map< String, Object>
parameters)
Callback is given the Function Name of the macro and a map of named parameters
(the map may contain String, Double, Boolean, Integer, Long, Map, or List
values).
|
Public Methods
public abstract Object getValue (String functionName, Map<String, Object>
parameters)
Callback is given the Function Name of the macro and a map of named parameters (the
map may contain String, Double, Boolean, Integer, Long, Map, or List values). It should
return an object which is the calculated value of the macro.
The functionName
is the same name by which the callback was registered.
It's provided as a convenience to allow a single callback to be registered for multiple
function call macros.
When application code makes a call to push an event to the data layer or to get a
data value from a Container
,
that may cause this callback to execute. The callback will execute on the same thread
as the push or get call.
Returns
- a String, Double, Boolean, Integer, or Long
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["`Container.FunctionCallMacroCallback` is an interface used by applications to define custom macros for calculating values within a Google Tag Manager container."],["The `getValue` method is the core of this interface, allowing developers to provide custom logic based on the function name and input parameters."],["Input parameters to the `getValue` method include a `functionName` string and a `parameters` map which may contain various data types."],["The return value of the `getValue` method represents the calculated value of the custom macro and must be one of the specified data types: String, Double, Boolean, Integer, or Long."],["The callback will execute on the same thread as any data layer push or get call made by the application code which triggers it."]]],["The `Container.FunctionCallMacroCallback` interface allows applications to define custom macro value calculations. It provides a `getValue` method that receives the macro's function name and a map of parameters. This method calculates and returns the macro's value as a String, Double, Boolean, Integer, or Long. The callback executes on the same thread when an event is pushed to the data layer or when retrieving a data value from a Container.\n"]]