---
title: "PATCH /userprofiles/{+profileId}/targetingTemplates"
method: PATCH
path: "/userprofiles/{+profileId}/targetingTemplates"
tags: ["targetingTemplates"]
---

# PATCH /userprofiles/{+profileId}/targetingTemplates

`PATCH /userprofiles/{+profileId}/targetingTemplates`

Updates an existing targeting template. This method supports patch semantics.

## Path parameters

- `profileId` string, required

## Query parameters

- `id` string, required

## Request body

- TargetingTemplate — Contains properties of a targeting template. A targeting template encapsulates targeting information which can be reused across multiple ads.
  - `id` string, int64 — ID of this targeting template. This is a read-only, auto-generated field.
  - `keyValueTargetingExpression` KeyValueTargetingExpression — Key Value Targeting Expression.
    - `expression` string — Keyword expression being targeted by the ad.
  - `listTargetingExpression` ListTargetingExpression — Remarketing List Targeting Expression.
    - `expression` string — Expression describing which lists are being targeted by the ad.
  - `dayPartTargeting` DayPartTargeting — Day Part Targeting.
    - `hoursOfDay` integer[] — Hours of the day when the ad will serve, where 0 is midnight to 1 AM and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. Acceptable values are 0 to 23, inclusive.
    - `userLocalTime` boolean — Whether or not to use the user's local time. If false, the America/New York time zone applies.
    - `daysOfWeek` string[] — Days of the week when the ad will serve. Acceptable values are: - "SUNDAY" - "MONDAY" - "TUESDAY" - "WEDNESDAY" - "THURSDAY" - "FRIDAY" - "SATURDAY"
  - `subaccountId` string, int64 — Subaccount ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.
  - `advertiserId` string, int64 — Advertiser ID of this targeting template. This is a required field on insert and is read-only after insert.
  - `contextualKeywordTargeting` ContextualKeywordTargeting — Contextual Keyword Targeting.
    - `keywords` ContextualKeyword[] — Contextual keywords that this ad targets
      - `keyword` string — The keyword that can be targeted by ads.
  - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplate".
  - `name` string — Name of this targeting template. This field is required. It must be less than 256 characters long and unique within an advertiser.
  - `accountId` string, int64 — Account ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.
  - `technologyTargeting` TechnologyTargeting — Technology Targeting.
    - `browsers` Browser[] — Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used. The other fields are populated automatically when the ad is inserted or updated.
      - `browserVersionId` string, int64 — ID referring to this grouping of browser and version numbers. This is the ID used for targeting.
      - `dartId` string, int64 — DART ID of this browser. This is the ID used when generating reports.
      - `name` string — Name of this browser.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#browser".
      - `majorVersion` string — Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is.
      - `minorVersion` string — Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is.
    - `connectionTypes` ConnectionType[] — Connection types that this ad targets. For each connection type only id is required. The other fields are populated automatically when the ad is inserted or updated.
      - `id` string, int64 — ID of this connection type.
      - `name` string — Name of this connection type.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionType".
    - `operatingSystemVersions` OperatingSystemVersion[] — Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems.
      - `id` string, int64 — ID of this operating system version.
      - `name` string — Name of this operating system version.
      - `majorVersion` string — Major version (leftmost number) of this operating system version.
      - `minorVersion` string — Minor version (number after the first dot) of this operating system version.
      - `operatingSystem` OperatingSystem — Contains information about an operating system that can be targeted by ads.
        - `dartId` string, int64 — DART ID of this operating system. This is the ID used for targeting.
        - `name` string — Name of this operating system.
        - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem".
        - `desktop` boolean — Whether this operating system is for desktop.
        - `mobile` boolean — Whether this operating system is for mobile.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersion".
    - `mobileCarriers` MobileCarrier[] — Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes.
      - `countryCode` string — Country code of the country to which this mobile carrier belongs.
      - `countryDartId` string, int64 — DART ID of the country to which this mobile carrier belongs.
      - `name` string — Name of this mobile carrier.
      - `id` string, int64 — ID of this mobile carrier.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarrier".
    - `platformTypes` PlatformType[] — Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformType".
      - `name` string — Name of this platform type.
      - `id` string, int64 — ID of this platform type.
    - `operatingSystems` OperatingSystem[] — Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system.
      - `dartId` string, int64 — DART ID of this operating system. This is the ID used for targeting.
      - `name` string — Name of this operating system.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem".
      - `desktop` boolean — Whether this operating system is for desktop.
      - `mobile` boolean — Whether this operating system is for mobile.
  - `geoTargeting` GeoTargeting — Geographical Targeting.
    - `regions` Region[] — Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region.
      - `name` string — Name of this region.
      - `countryCode` string — Country code of the country to which this region belongs.
      - `countryDartId` string, int64 — DART ID of the country to which this region belongs.
      - `regionCode` string — Region code.
      - `dartId` string, int64 — DART ID of this region.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#region".
    - `metros` Metro[] — Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro.
      - `dmaId` string, int64 — DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code.
      - `name` string — Name of this metro region.
      - `countryCode` string — Country code of the country to which this metro region belongs.
      - `countryDartId` string, int64 — DART ID of the country to which this metro region belongs.
      - `dartId` string, int64 — DART ID of this metro region.
      - `metroCode` string — Metro code of this metro region. This is equivalent to dma_id.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#metro".
    - `cities` City[] — Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city.
      - `regionDartId` string, int64 — DART ID of the region to which this city belongs.
      - `metroCode` string — Metro region code of the metro region (DMA) to which this city belongs.
      - `dartId` string, int64 — DART ID of this city. This is the ID used for targeting and generating reports.
      - `regionCode` string — Region code of the region to which this city belongs.
      - `name` string — Name of this city.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#city".
      - `countryCode` string — Country code of the country to which this city belongs.
      - `countryDartId` string, int64 — DART ID of the country to which this city belongs.
      - `metroDmaId` string, int64 — ID of the metro region (DMA) to which this city belongs.
    - `excludeCountries` boolean — Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad.
    - `postalCodes` PostalCode[] — Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code.
      - `code` string — Postal code. This is equivalent to the id field.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCode".
      - `id` string — ID of this postal code.
      - `countryCode` string — Country code of the country to which this postal code belongs.
      - `countryDartId` string, int64 — DART ID of the country to which this postal code belongs.
    - `countries` Country[] — Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#country".
      - `name` string — Name of this country.
      - `countryCode` string — Country code.
      - `dartId` string, int64 — DART ID of this country. This is the ID used for targeting and generating reports.
      - `sslEnabled` boolean — Whether ad serving supports secure servers in this country.
      - `tvDataProviders` string[] — Output only. The TV data providers supported in this country.
  - `languageTargeting` LanguageTargeting — Language Targeting.
    - `languages` Language[] — Languages that this ad targets. For each language only languageId is required. The other fields are populated automatically when the ad is inserted or updated.
      - `kind` string — Identifies what kind of resource this is. Value: the fixed string "dfareporting#language".
      - `languageCode` string — Format of language code is an ISO 639 two-letter language code optionally followed by an underscore followed by an ISO 3166 code. Examples are "en" for English or "zh_CN" for Simplified Chinese.
      - `name` string — Name of this language.
      - `id` string, int64 — Language ID of this language. This is the ID used for targeting and generating reports.
  - `advertiserIdDimensionValue` DimensionValue — Represents a DimensionValue resource.
    - `id` string — The ID associated with the value if available.
    - `dimensionName` string — The name of the dimension.
    - `value` string — The value of the dimension.
    - `matchType` 'EXACT' | 'BEGINS_WITH' | 'CONTAINS' | 'WILDCARD_EXPRESSION' — Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT.
    - `kind` string — The kind of resource this is, in this case dfareporting#dimensionValue.
    - `etag` string — The eTag of this response for caching purposes.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/dfareporting.md) · [All operations](https://skmtc.net/google/apis/dfareporting/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/dfareporting/revisions/8163d57aeb31/schema)
