The set command

The set command enables you to set values that persist across gtag calls.

The syntax of the set command follows:

gtag('set', values);
gtag('set', 'key', 'value');

where:

  • values is a JavaScript object containing key-value pairs.

  • key is a parameter name of type string and value is the value of the parameter to persist across gtag calls. Both key and value are required.

For example:

gtag('set', { 'send_to': 'GA_TRACKING_ID' });