or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

ad-management.mdasset-management.mdaudience-management.mdbatch-operations.mdcampaign-management.mdclient-setup.mdconversion-tracking.mdindex.mdreporting-search.mdtargeting-keywords.md

targeting-keywords.mddocs/

0

# Targeting and Keywords

1

2

Keyword research, planning, and management including keyword plan creation, keyword idea generation, shared keyword sets, and advanced targeting configurations. The Google Ads API provides comprehensive capabilities for keyword research, competitive analysis, and targeting optimization.

3

4

## Capabilities

5

6

### Keyword Plan Services

7

8

Keyword planning operations for research, forecasting, and planning keyword strategies including competitive analysis and traffic estimation.

9

10

```python { .api }

11

def mutate_keyword_plans(

12

self,

13

request: Optional[MutateKeywordPlansRequest] = None,

14

customer_id: Optional[str] = None,

15

operations: Optional[Sequence[KeywordPlanOperation]] = None,

16

partial_failure: bool = False,

17

validate_only: bool = False

18

) -> MutateKeywordPlansResponse:

19

"""

20

Create, update, or remove keyword plans.

21

22

Args:

23

request: The request object

24

customer_id: Required customer ID

25

operations: List of keyword plan operations

26

partial_failure: Continue on individual failures

27

validate_only: Validate without executing

28

29

Returns:

30

MutateKeywordPlansResponse with results

31

"""

32

33

def generate_forecast_curve(

34

self,

35

request: Optional[GenerateForecastCurveRequest] = None,

36

keyword_plan: Optional[str] = None

37

) -> GenerateForecastCurveResponse:

38

"""

39

Generate forecast curve for a keyword plan.

40

41

Args:

42

request: The request object

43

keyword_plan: Keyword plan resource name

44

45

Returns:

46

Forecast curve with traffic and cost projections

47

"""

48

49

def generate_forecast_timeline(

50

self,

51

request: Optional[GenerateForecastTimelineRequest] = None,

52

keyword_plan: Optional[str] = None

53

) -> GenerateForecastTimelineResponse:

54

"""

55

Generate forecast timeline for a keyword plan.

56

57

Args:

58

request: The request object

59

keyword_plan: Keyword plan resource name

60

61

Returns:

62

Timeline forecast with weekly projections

63

"""

64

65

def generate_forecast_metrics(

66

self,

67

request: Optional[GenerateForecastMetricsRequest] = None,

68

keyword_plan: Optional[str] = None

69

) -> GenerateForecastMetricsResponse:

70

"""

71

Generate forecast metrics for a keyword plan.

72

73

Args:

74

request: The request object

75

keyword_plan: Keyword plan resource name

76

77

Returns:

78

Forecast metrics including clicks, impressions, and costs

79

"""

80

```

81

82

### Keyword Idea Generation

83

84

Keyword research and idea generation operations for discovering new keyword opportunities, competitive analysis, and search volume data.

85

86

```python { .api }

87

def generate_keyword_ideas(

88

self,

89

request: Optional[GenerateKeywordIdeasRequest] = None,

90

customer_id: Optional[str] = None,

91

language: Optional[str] = None,

92

geo_target_constants: Optional[Sequence[str]] = None,

93

keyword_plan_network: Optional[KeywordPlanNetworkEnum.KeywordPlanNetwork] = None,

94

keyword_annotation: Optional[Sequence[KeywordAnnotationEnum.KeywordAnnotation]] = None

95

) -> GenerateKeywordIdeasResponse:

96

"""

97

Generate keyword ideas based on seed keywords or URLs.

98

99

Args:

100

request: The request object

101

customer_id: Required customer ID

102

language: Language for keyword ideas

103

geo_target_constants: Geographic targeting

104

keyword_plan_network: Network for keyword planning

105

keyword_annotation: Additional keyword annotations

106

107

Returns:

108

GenerateKeywordIdeasResponse with keyword suggestions

109

"""

110

111

def generate_keyword_historical_metrics(

112

self,

113

request: Optional[GenerateKeywordHistoricalMetricsRequest] = None,

114

customer_id: Optional[str] = None,

115

keywords: Optional[Sequence[str]] = None,

116

language: Optional[str] = None,

117

geo_target_constants: Optional[Sequence[str]] = None,

118

keyword_plan_network: Optional[KeywordPlanNetworkEnum.KeywordPlanNetwork] = None

119

) -> GenerateKeywordHistoricalMetricsResponse:

120

"""

121

Get historical metrics for specific keywords.

122

123

Args:

124

request: The request object

125

customer_id: Required customer ID

126

keywords: List of keywords to analyze

127

language: Language for metrics

128

geo_target_constants: Geographic targeting

129

keyword_plan_network: Network for metrics

130

131

Returns:

132

Historical metrics including search volume and competition

133

"""

134

135

def generate_ad_group_themes(

136

self,

137

request: Optional[GenerateAdGroupThemesRequest] = None,

138

customer_id: Optional[str] = None,

139

keywords: Optional[Sequence[str]] = None,

140

ad_groups: Optional[Sequence[str]] = None

141

) -> GenerateAdGroupThemesResponse:

142

"""

143

Generate ad group themes for keyword organization.

144

145

Args:

146

request: The request object

147

customer_id: Required customer ID

148

keywords: Keywords to organize into themes

149

ad_groups: Existing ad groups for theme analysis

150

151

Returns:

152

Suggested ad group themes and keyword groupings

153

"""

154

```

155

156

### Shared Set Management

157

158

Shared keyword set operations for managing negative keyword lists and other shared targeting criteria across multiple campaigns and ad groups.

159

160

```python { .api }

161

def mutate_shared_sets(

162

self,

163

request: Optional[MutateSharedSetsRequest] = None,

164

customer_id: Optional[str] = None,

165

operations: Optional[Sequence[SharedSetOperation]] = None,

166

partial_failure: bool = False,

167

validate_only: bool = False,

168

response_content_type: Optional[ResponseContentTypeEnum.ResponseContentType] = None

169

) -> MutateSharedSetsResponse:

170

"""

171

Create, update, or remove shared sets.

172

173

Args:

174

request: The request object

175

customer_id: Required customer ID

176

operations: List of shared set operations

177

partial_failure: Continue on individual failures

178

validate_only: Validate without executing

179

response_content_type: Response content type

180

181

Returns:

182

MutateSharedSetsResponse with results

183

"""

184

185

def mutate_shared_criteria(

186

self,

187

request: Optional[MutateSharedCriteriaRequest] = None,

188

customer_id: Optional[str] = None,

189

operations: Optional[Sequence[SharedCriterionOperation]] = None,

190

partial_failure: bool = False,

191

validate_only: bool = False,

192

response_content_type: Optional[ResponseContentTypeEnum.ResponseContentType] = None

193

) -> MutateSharedCriteriaResponse:

194

"""

195

Create, update, or remove shared criteria.

196

197

Args:

198

request: The request object

199

customer_id: Required customer ID

200

operations: List of shared criterion operations

201

partial_failure: Continue on individual failures

202

validate_only: Validate without executing

203

response_content_type: Response content type

204

205

Returns:

206

MutateSharedCriteriaResponse with results

207

"""

208

```

209

210

### Geographic Targeting

211

212

Geographic and location targeting operations including geo target constants, location views, and proximity targeting configurations.

213

214

```python { .api }

215

def get_geo_target_constant(

216

self,

217

request: Optional[GetGeoTargetConstantRequest] = None,

218

resource_name: Optional[str] = None

219

) -> GeoTargetConstant:

220

"""

221

Retrieve geographic target constant information.

222

223

Args:

224

request: The request object

225

resource_name: Geo target constant resource name

226

227

Returns:

228

GeoTargetConstant with location details

229

"""

230

231

def suggest_geo_target_constants(

232

self,

233

request: Optional[SuggestGeoTargetConstantsRequest] = None,

234

locale: Optional[str] = None,

235

country_code: Optional[str] = None

236

) -> SuggestGeoTargetConstantsResponse:

237

"""

238

Suggest geographic target constants based on location names.

239

240

Args:

241

request: The request object

242

locale: Locale for suggestions

243

country_code: Country code for suggestions

244

245

Returns:

246

Suggested geographic target constants

247

"""

248

```

249

250

## Keyword Planning Examples

251

252

### Create Keyword Plan

253

254

```python

255

from google.ads.googleads.client import GoogleAdsClient

256

from google.ads.googleads.errors import GoogleAdsException

257

import datetime

258

259

def create_keyword_plan(client, customer_id, plan_name):

260

"""Create a keyword plan for keyword research and forecasting."""

261

262

keyword_plan_service = client.get_service("KeywordPlanService")

263

264

# Create keyword plan

265

operation = client.get_type("KeywordPlanOperation")

266

keyword_plan = operation.create

267

keyword_plan.name = plan_name

268

269

# Set forecast period (next 12 months)

270

forecast_period = keyword_plan.forecast_period

271

forecast_period.date_interval = client.enums.KeywordPlanForecastIntervalEnum.NEXT_QUARTER

272

273

try:

274

response = keyword_plan_service.mutate_keyword_plans(

275

customer_id=customer_id,

276

operations=[operation]

277

)

278

279

keyword_plan_resource_name = response.results[0].resource_name

280

print(f"Created keyword plan: {keyword_plan_resource_name}")

281

return keyword_plan_resource_name

282

283

except GoogleAdsException as ex:

284

print(f"Request failed with status {ex.error.code().name}")

285

for error in ex.failure.errors:

286

print(f"Error: {error.message}")

287

return None

288

```

289

290

### Add Keyword Plan Campaign

291

292

```python

293

def create_keyword_plan_campaign(client, customer_id, keyword_plan_resource_name, campaign_name):

294

"""Create a keyword plan campaign within a keyword plan."""

295

296

keyword_plan_campaign_service = client.get_service("KeywordPlanCampaignService")

297

298

operation = client.get_type("KeywordPlanCampaignOperation")

299

campaign = operation.create

300

campaign.name = campaign_name

301

campaign.keyword_plan = keyword_plan_resource_name

302

303

# Set targeting

304

campaign.cpc_bid_micros = 1000000 # $1.00 default bid

305

campaign.keyword_plan_network = client.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH

306

307

# Set geographic targeting (US)

308

geo_target = client.get_type("KeywordPlanGeoTarget")

309

geo_target.geo_target_constant = "geoTargetConstants/2840" # United States

310

campaign.geo_targets.append(geo_target)

311

312

# Set language targeting (English)

313

language_constant = "languageConstants/1000" # English

314

campaign.language_constants.append(language_constant)

315

316

response = keyword_plan_campaign_service.mutate_keyword_plan_campaigns(

317

customer_id=customer_id,

318

operations=[operation]

319

)

320

321

return response.results[0].resource_name

322

```

323

324

### Add Keywords to Plan

325

326

```python

327

def add_keywords_to_plan(client, customer_id, keyword_plan_ad_group_resource_name, keywords):

328

"""Add keywords to a keyword plan ad group."""

329

330

keyword_plan_ad_group_keyword_service = client.get_service("KeywordPlanAdGroupKeywordService")

331

332

operations = []

333

334

for keyword_text in keywords:

335

operation = client.get_type("KeywordPlanAdGroupKeywordOperation")

336

keyword = operation.create

337

keyword.ad_group = keyword_plan_ad_group_resource_name

338

keyword.text = keyword_text

339

keyword.match_type = client.enums.KeywordMatchTypeEnum.BROAD

340

keyword.cpc_bid_micros = 2000000 # $2.00 bid

341

342

operations.append(operation)

343

344

response = keyword_plan_ad_group_keyword_service.mutate_keyword_plan_ad_group_keywords(

345

customer_id=customer_id,

346

operations=operations

347

)

348

349

return [result.resource_name for result in response.results]

350

```

351

352

## Keyword Research Examples

353

354

### Generate Keyword Ideas

355

356

```python

357

def generate_keyword_ideas(client, customer_id, seed_keywords, location_ids, language_id):

358

"""Generate keyword ideas based on seed keywords."""

359

360

keyword_plan_idea_service = client.get_service("KeywordPlanIdeaService")

361

362

request = client.get_type("GenerateKeywordIdeasRequest")

363

request.customer_id = customer_id

364

365

# Set up keyword seed

366

keyword_seed = request.keyword_seed

367

keyword_seed.keywords.extend(seed_keywords)

368

369

# Set targeting

370

request.geo_target_constants = [f"geoTargetConstants/{loc_id}" for loc_id in location_ids]

371

request.language = f"languageConstants/{language_id}"

372

request.keyword_plan_network = client.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH_AND_PARTNERS

373

374

# Include keyword annotations for additional data

375

request.keyword_annotation = [

376

client.enums.KeywordAnnotationEnum.KEYWORD_CONCEPT

377

]

378

379

try:

380

response = keyword_plan_idea_service.generate_keyword_ideas(request=request)

381

382

ideas = []

383

for result in response.results:

384

idea = {

385

'keyword': result.text,

386

'avg_monthly_searches': result.keyword_idea_metrics.avg_monthly_searches,

387

'competition': result.keyword_idea_metrics.competition.name,

388

'competition_index': result.keyword_idea_metrics.competition_index,

389

'low_top_of_page_bid_micros': result.keyword_idea_metrics.low_top_of_page_bid_micros,

390

'high_top_of_page_bid_micros': result.keyword_idea_metrics.high_top_of_page_bid_micros

391

}

392

ideas.append(idea)

393

394

return ideas

395

396

except GoogleAdsException as ex:

397

print(f"Request failed with status {ex.error.code().name}")

398

for error in ex.failure.errors:

399

print(f"Error: {error.message}")

400

return []

401

402

# Example usage

403

seed_keywords = ["running shoes", "athletic footwear", "sports sneakers"]

404

location_ids = [2840] # United States

405

language_id = 1000 # English

406

407

ideas = generate_keyword_ideas(client, customer_id, seed_keywords, location_ids, language_id)

408

409

for idea in ideas:

410

print(f"Keyword: {idea['keyword']}")

411

print(f"Avg Monthly Searches: {idea['avg_monthly_searches']}")

412

print(f"Competition: {idea['competition']}")

413

print(f"Top of Page Bid Range: ${idea['low_top_of_page_bid_micros']/1_000_000:.2f} - ${idea['high_top_of_page_bid_micros']/1_000_000:.2f}")

414

print("---")

415

```

416

417

### Get Historical Metrics

418

419

```python

420

def get_keyword_historical_metrics(client, customer_id, keywords, location_ids, language_id):

421

"""Get historical search volume and competition metrics for keywords."""

422

423

keyword_plan_idea_service = client.get_service("KeywordPlanIdeaService")

424

425

request = client.get_type("GenerateKeywordHistoricalMetricsRequest")

426

request.customer_id = customer_id

427

request.keywords = keywords

428

request.geo_target_constants = [f"geoTargetConstants/{loc_id}" for loc_id in location_ids]

429

request.language = f"languageConstants/{language_id}"

430

request.keyword_plan_network = client.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH

431

432

response = keyword_plan_idea_service.generate_keyword_historical_metrics(request=request)

433

434

metrics = []

435

for result in response.results:

436

metric = {

437

'keyword': result.text,

438

'search_volume': result.keyword_metrics.avg_monthly_searches,

439

'competition': result.keyword_metrics.competition.name,

440

'competition_index': result.keyword_metrics.competition_index,

441

'monthly_search_volumes': []

442

}

443

444

# Monthly breakdown

445

for monthly_volume in result.keyword_metrics.monthly_search_volumes:

446

monthly_data = {

447

'year': monthly_volume.year,

448

'month': monthly_volume.month.name,

449

'searches': monthly_volume.monthly_searches

450

}

451

metric['monthly_search_volumes'].append(monthly_data)

452

453

metrics.append(metric)

454

455

return metrics

456

```

457

458

## Negative Keywords Management

459

460

### Create Shared Negative Keywords List

461

462

```python

463

def create_negative_keyword_list(client, customer_id, list_name, negative_keywords):

464

"""Create a shared negative keyword list."""

465

466

# Create shared set

467

shared_set_service = client.get_service("SharedSetService")

468

shared_criterion_service = client.get_service("SharedCriterionService")

469

470

# Create the shared set

471

set_operation = client.get_type("SharedSetOperation")

472

shared_set = set_operation.create

473

shared_set.name = list_name

474

shared_set.type_ = client.enums.SharedSetTypeEnum.NEGATIVE_KEYWORDS

475

476

set_response = shared_set_service.mutate_shared_sets(

477

customer_id=customer_id,

478

operations=[set_operation]

479

)

480

481

shared_set_resource_name = set_response.results[0].resource_name

482

483

# Add negative keywords to the shared set

484

criterion_operations = []

485

486

for keyword_text in negative_keywords:

487

criterion_operation = client.get_type("SharedCriterionOperation")

488

criterion = criterion_operation.create

489

criterion.shared_set = shared_set_resource_name

490

criterion.keyword.text = keyword_text

491

criterion.keyword.match_type = client.enums.KeywordMatchTypeEnum.BROAD

492

493

criterion_operations.append(criterion_operation)

494

495

if criterion_operations:

496

criterion_response = shared_criterion_service.mutate_shared_criteria(

497

customer_id=customer_id,

498

operations=criterion_operations

499

)

500

501

return shared_set_resource_name

502

503

# Example usage

504

negative_keywords = [

505

"free",

506

"cheap",

507

"used",

508

"broken",

509

"repair"

510

]

511

512

list_resource_name = create_negative_keyword_list(

513

client,

514

customer_id,

515

"Brand Protection List",

516

negative_keywords

517

)

518

```

519

520

### Associate Negative List with Campaign

521

522

```python

523

def associate_negative_list_with_campaign(client, customer_id, campaign_resource_name, shared_set_resource_name):

524

"""Associate a shared negative keyword list with a campaign."""

525

526

campaign_shared_set_service = client.get_service("CampaignSharedSetService")

527

528

operation = client.get_type("CampaignSharedSetOperation")

529

campaign_shared_set = operation.create

530

campaign_shared_set.campaign = campaign_resource_name

531

campaign_shared_set.shared_set = shared_set_resource_name

532

533

response = campaign_shared_set_service.mutate_campaign_shared_sets(

534

customer_id=customer_id,

535

operations=[operation]

536

)

537

538

return response.results[0].resource_name

539

```

540

541

## Geographic Targeting Examples

542

543

### Get Location Suggestions

544

545

```python

546

def get_location_suggestions(client, location_names, locale="en", country_code="US"):

547

"""Get geographic target constant suggestions for location names."""

548

549

geo_target_constant_service = client.get_service("GeoTargetConstantService")

550

551

request = client.get_type("SuggestGeoTargetConstantsRequest")

552

request.locale = locale

553

request.country_code = country_code

554

555

# Add location names

556

for location_name in location_names:

557

location_name_filter = request.location_names.names.add()

558

location_name_filter.name = location_name

559

560

response = geo_target_constant_service.suggest_geo_target_constants(request=request)

561

562

suggestions = []

563

for suggestion in response.geo_target_constant_suggestions:

564

geo_target_constant = suggestion.geo_target_constant

565

suggestion_data = {

566

'resource_name': geo_target_constant.resource_name,

567

'id': geo_target_constant.id,

568

'name': geo_target_constant.name,

569

'country_code': geo_target_constant.country_code,

570

'target_type': geo_target_constant.target_type.name,

571

'status': geo_target_constant.status.name

572

}

573

suggestions.append(suggestion_data)

574

575

return suggestions

576

577

# Example usage

578

location_names = ["New York", "Los Angeles", "Chicago"]

579

suggestions = get_location_suggestions(client, location_names)

580

581

for suggestion in suggestions:

582

print(f"Location: {suggestion['name']}")

583

print(f"ID: {suggestion['id']}")

584

print(f"Type: {suggestion['target_type']}")

585

print("---")

586

```

587

588

### Proximity Targeting

589

590

```python

591

def create_proximity_targeting(client, customer_id, campaign_resource_name, address, radius_miles):

592

"""Add proximity (radius) targeting to a campaign."""

593

594

campaign_criterion_service = client.get_service("CampaignCriterionService")

595

596

operation = client.get_type("CampaignCriterionOperation")

597

criterion = operation.create

598

criterion.campaign = campaign_resource_name

599

criterion.type_ = client.enums.CriterionTypeEnum.PROXIMITY

600

601

# Set proximity details

602

proximity = criterion.proximity

603

proximity.address.street_address = address['street']

604

proximity.address.city_name = address['city']

605

proximity.address.province_code = address['state']

606

proximity.address.postal_code = address['zip']

607

proximity.address.country_code = address['country']

608

proximity.radius = radius_miles

609

proximity.radius_units = client.enums.ProximityRadiusUnitsEnum.MILES

610

611

response = campaign_criterion_service.mutate_campaign_criteria(

612

customer_id=customer_id,

613

operations=[operation]

614

)

615

616

return response.results[0].resource_name

617

618

# Example usage

619

store_address = {

620

'street': '123 Main St',

621

'city': 'New York',

622

'state': 'NY',

623

'zip': '10001',

624

'country': 'US'

625

}

626

627

proximity_criterion = create_proximity_targeting(

628

client,

629

customer_id,

630

campaign_resource_name,

631

store_address,

632

10 # 10 mile radius

633

)

634

```

635

636

## Types

637

638

```python { .api }

639

# Keyword plan types

640

class KeywordPlan:

641

resource_name: str

642

id: Optional[int]

643

name: Optional[str]

644

forecast_period: KeywordPlanForecastPeriod

645

646

class KeywordPlanForecastPeriod:

647

date_interval: KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval

648

date_range: DateRange

649

650

class KeywordPlanCampaign:

651

resource_name: str

652

keyword_plan: Optional[str]

653

id: Optional[int]

654

name: Optional[str]

655

language_constants: List[str]

656

keyword_plan_network: KeywordPlanNetworkEnum.KeywordPlanNetwork

657

cpc_bid_micros: Optional[int]

658

geo_targets: List[KeywordPlanGeoTarget]

659

660

class KeywordPlanAdGroup:

661

resource_name: str

662

keyword_plan_campaign: Optional[str]

663

id: Optional[int]

664

name: Optional[str]

665

cpc_bid_micros: Optional[int]

666

667

class KeywordPlanAdGroupKeyword:

668

resource_name: str

669

ad_group: Optional[str]

670

id: Optional[int]

671

text: Optional[str]

672

match_type: KeywordMatchTypeEnum.KeywordMatchType

673

cpc_bid_micros: Optional[int]

674

negative: Optional[bool]

675

676

# Keyword idea types

677

class KeywordIdea:

678

text: Optional[str]

679

keyword_idea_metrics: KeywordPlanHistoricalMetrics

680

681

class KeywordPlanHistoricalMetrics:

682

avg_monthly_searches: Optional[int]

683

monthly_search_volumes: List[MonthlySearchVolume]

684

competition: KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel

685

competition_index: Optional[int]

686

low_top_of_page_bid_micros: Optional[int]

687

high_top_of_page_bid_micros: Optional[int]

688

689

class MonthlySearchVolume:

690

year: Optional[int]

691

month: MonthOfYearEnum.MonthOfYear

692

monthly_searches: Optional[int]

693

694

# Shared set types

695

class SharedSet:

696

resource_name: str

697

id: Optional[int]

698

type_: SharedSetTypeEnum.SharedSetType

699

name: Optional[str]

700

status: SharedSetStatusEnum.SharedSetStatus

701

member_count: Optional[int]

702

reference_count: Optional[int]

703

704

class SharedCriterion:

705

resource_name: str

706

shared_set: Optional[str]

707

criterion_id: Optional[int]

708

type_: CriterionTypeEnum.CriterionType

709

710

# Criterion types (subset of available types)

711

keyword: KeywordInfo

712

youtube_video: YouTubeVideoInfo

713

youtube_channel: YouTubeChannelInfo

714

placement: PlacementInfo

715

mobile_app_category: MobileAppCategoryInfo

716

717

# Geographic targeting types

718

class GeoTargetConstant:

719

resource_name: str

720

id: Optional[int]

721

name: Optional[str]

722

country_code: Optional[str]

723

target_type: Optional[str]

724

status: GeoTargetConstantStatusEnum.GeoTargetConstantStatus

725

canonical_name: Optional[str]

726

parent_geo_target: Optional[str]

727

728

class ProximityInfo:

729

geo_point: GeoPointInfo

730

radius: Optional[float]

731

radius_units: ProximityRadiusUnitsEnum.ProximityRadiusUnits

732

address: AddressInfo

733

734

class AddressInfo:

735

postal_code: Optional[str]

736

province_code: Optional[str]

737

country_code: Optional[str]

738

province_name: Optional[str]

739

street_address: Optional[str]

740

street_address2: Optional[str]

741

city_name: Optional[str]

742

743

# Request types

744

class GenerateKeywordIdeasRequest:

745

customer_id: str

746

language: Optional[str]

747

geo_target_constants: List[str]

748

keyword_plan_network: KeywordPlanNetworkEnum.KeywordPlanNetwork

749

keyword_annotation: List[KeywordAnnotationEnum.KeywordAnnotation]

750

aggregate_metrics: AggregateMetricsSelector

751

752

# One of the following seed sources

753

keyword_seed: KeywordSeed

754

url_seed: UrlSeed

755

site_seed: SiteSeed

756

757

class KeywordSeed:

758

keywords: List[str]

759

760

class UrlSeed:

761

url: Optional[str]

762

763

# Response types

764

class GenerateKeywordIdeasResponse:

765

results: List[KeywordIdea]

766

aggregate_metric_results: KeywordPlanAggregateMetrics

767

next_page_token: str

768

total_size: int

769

770

class GenerateKeywordHistoricalMetricsResponse:

771

results: List[KeywordPlanKeywordHistoricalMetrics]

772

aggregate_metric_results: KeywordPlanAggregateMetrics

773

774

# Operation types

775

class KeywordPlanOperation:

776

update_mask: FieldMask

777

create: KeywordPlan

778

update: KeywordPlan

779

remove: str

780

781

class SharedSetOperation:

782

update_mask: FieldMask

783

create: SharedSet

784

update: SharedSet

785

remove: str

786

787

class SharedCriterionOperation:

788

update_mask: FieldMask

789

create: SharedCriterion

790

update: SharedCriterion

791

remove: str

792

```