Skip to content
Start here

Update Google Tag Gateway configuration

client.GoogleTagGateway.Config.Update(ctx, params) (*Config, error)
PUT/zones/{zone_id}/settings/google-tag-gateway/config

Updates the Google Tag Gateway configuration for a zone.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zone Settings Write
ParametersExpand Collapse
params ConfigUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Config param.Field[Config]

Body param: Google Tag Gateway configuration for a zone.

ReturnsExpand Collapse
type Config struct{…}

Google Tag Gateway configuration for a zone.

Enabled bool

Enables or disables Google Tag Gateway for this zone.

Endpoint string

Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with ’/’, with no nested paths and alphanumeric characters only (e.g. /metrics).

HideOriginalIP bool

Hides the original client IP address from Google when enabled.

MeasurementID string

Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).

SetUpTag boolOptional

Set up the associated Google Tag on the zone automatically when enabled.

Update Google Tag Gateway configuration

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/google_tag_gateway"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  config, err := client.GoogleTagGateway.Config.Update(context.TODO(), google_tag_gateway.ConfigUpdateParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Config: google_tag_gateway.ConfigParam{
      Enabled: cloudflare.F(true),
      Endpoint: cloudflare.F("/metrics"),
      HideOriginalIP: cloudflare.F(true),
      MeasurementID: cloudflare.F("GTM-P2F3N47Q"),
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", config.HideOriginalIP)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "enabled": true,
    "endpoint": "/metrics",
    "hideOriginalIp": true,
    "measurementId": "GTM-P2F3N47Q",
    "setUpTag": true
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "enabled": true,
    "endpoint": "/metrics",
    "hideOriginalIp": true,
    "measurementId": "GTM-P2F3N47Q",
    "setUpTag": true
  }
}