Guides
Campaigns

Targeting

Locations, radius, language, ad schedule, negative keywords and ad group keywords, with suggest to find cities.

A search campaign's targeting lives in campaign criteria (campaignCriterionOperation) and in ad group criteria (adGroupCriterionOperation, the keywords). A criterion is immutable: to change it, remove it and create it again.

Find the location

bash
curl --request POST \
  --url https://google-ads.mimicr.dev/v26/geoTargetConstants:suggest \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "locale": "pt", "countryCode": "BR", "locationNames": { "names": ["Goiânia"] } }'
json
{
  "geoTargetConstantSuggestions": [{
    "geoTargetConstant": {
      "resourceName": "geoTargetConstants/1001552",
      "id": "1001552",
      "name": "Goiânia",
      "countryCode": "BR",
      "targetType": "City",
      "status": "ENABLED",
      "canonicalName": "Goiania,State of Goias,Brazil",
      "parentGeoTarget": "geoTargetConstants/20092"
    },
    "locale": "pt",
    "reach": "215957",
    "searchTerm": "Goiânia"
  }]
}

No login-customer-id. Up to 25 names per call (more gives collectionSizeError: TOO_MANY). In Mimicr, the search ignores case and accents and uses Google's official geotargets for Brazil (country, states, cities and municipalities) and every country. See Suggest locations.

Campaign criteria

TypeBodyRules
Locationlocation: {geoTargetConstant: "geoTargetConstants/1001552"}The id must exist (criterionError: INVALID_CRITERION_ID). Accepts negative: true. The criterion id is the location id
Radiusproximity: {geoPoint: {latitudeInMicroDegrees, longitudeInMicroDegrees}, radius, radiusUnits: "KILOMETERS"}In Mimicr, 1 to 800 km or 0.5 to 500 miles (INVALID_PROXIMITY_RADIUS). Does not accept negative
Languagelanguage: {languageConstant: "languageConstants/1014"}Portuguese is 1014. The criterion id is the language id
Ad scheduleadSchedule: {dayOfWeek, startHour, startMinute, endHour, endMinute}Minutes ZERO, FIFTEEN, THIRTY or FORTY_FIVE; endHour up to 24; at most 6 slots per day, without overlap
Negative keywordnegative: true, keyword: {text, matchType}Only negatives at the campaign level
json
{
  "campaignCriterionOperation": {
    "create": {
      "campaign": "customers/2220330728/campaigns/54542599977",
      "proximity": {
        "geoPoint": { "latitudeInMicroDegrees": -16686900, "longitudeInMicroDegrees": -49264800 },
        "radius": 5,
        "radiusUnits": "KILOMETERS"
      }
    }
  }
}

Other types (device, age, audiences, placements) answer campaignCriterionError: CANNOT_ADD_CRITERIA_TYPE with the suffix "(not simulated by Mimicr)". Including and excluding the same location gives CANNOT_TARGET_AND_EXCLUDE. A campaign with neither a location nor a radius targets the whole world; Mimicr delivers anyway.

Ad group keywords

json
{
  "adGroupCriterionOperation": {
    "create": {
      "adGroup": "customers/2220330728/adGroups/54542599986",
      "status": "ENABLED",
      "keyword": { "text": "gás de cozinha barato", "matchType": "PHRASE" }
    }
  }
}
RuleError
Up to 80 characterscriterionError: KEYWORD_TEXT_TOO_LONG
Up to 10 wordsKEYWORD_HAS_TOO_MANY_WORDS
Not emptyINVALID_KEYWORD_TEXT
No characters such as ! @ % , * = ^ ; < > ~KEYWORD_HAS_INVALID_CHARS
Repeated in the same requestdistinctError: DUPLICATE_ELEMENT

matchType is EXACT, PHRASE or BROAD. On update, only status, cpcBidMicros and finalUrls change. Read-only fields: approvalStatus (DISAPPROVED with [reprovar] in the text or keyword.disapprove), systemServingStatus (RARELY_SERVED with 7 or more words) and qualityInfo.qualityScore.

A search campaign without an enabled positive keyword stays NOT_ELIGIBLE (NO_KEYWORDS).

Change the targeting

Criteria have no update of the criterion itself (only status and bidModifier). To change locations or schedules, query the current ones, remove them and create the new ones in the same mutate:

bash
curl --request POST \
  --url https://google-ads.mimicr.dev/v26/customers/2220330728/googleAds:search \
  --header 'Authorization: Bearer <token>' \
  --header 'login-customer-id: 6446154552' \
  --header 'Content-Type: application/json' \
  --data '{ "query": "SELECT campaign_criterion.resource_name FROM campaign_criterion WHERE campaign.id = 54542599977 AND campaign_criterion.type IN (\"PROXIMITY\", \"LOCATION\", \"AD_SCHEDULE\")" }'

In Mimicr, removed criteria only show up in GAQL when the query filters on their status. That way, querying, removing and recreating several times never tries to remove again what was already removed (which would give mutateError: RESOURCE_NOT_FOUND).