gads

package module
v0.0.0-...-a11d707 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 20 Imported by: 3

README

gads

Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.

Package gads provides a wrapper for the Google Adwords SOAP API.

installation

go get github.com/emiddleton/gads

setup

In order to access the API you will need to sign up for an MMC account[1], get a developer token[2] and setup authentication[3]. There is a tool in the setup_oauth2 directory that will help you setup a configuration file.

  1. http://www.google.com/adwords/myclientcenter/
  2. https://developers.google.com/adwords/api/docs/signingup
  3. https://developers.google.com/adwords/api/docs/guides/authentication

usage

The package is comprised of services used to manipulate various adwords structures. To access a service you need to create an gads.Auth and parse it to the service initializer, then can call the service methods on the service object.

     authConf, err := NewCredentials(context.TODO())
     campaignService := gads.NewCampaignService(&authConf.Auth)

     campaigns, totalCount, err := campaignService.Get(
       gads.Selector{
         Fields: []string{
           "Id",
           "Name",
           "Status",
         },
       },
     )

Note: This package is a work-in-progress, and may occasionally make backwards-incompatible changes.

See godoc for further documentation and examples.

about

Gads is developed by Edward Middleton

Documentation

Overview

Package gads provides a wrapper for the Google Adwords SOAP API. In order to access the API you will need to sign up for an MMC account[1], get a developer token[2], setup authentication[3]. The is a tool in the setup_oauth2 directory that will setup a configuration file.

The package is comprised of services used to manipulate various adwords structures. To access a service you need to create an gads.Auth and parse it to the service initializer, then can call the service methods on the service object.

authConf, err := NewCredentials(context.TODO())
campaignService := gads.NewCampaignService(&authConf.Auth)

campaigns, totalCount, err := cs.Get(
  gads.Selector{
    Fields: []string{
      "Id",
      "Name",
      "Status",
    },
  },
)

1. http://www.google.com/adwords/myclientcenter/

2. https://developers.google.com/adwords/api/docs/signingup

3. https://developers.google.com/adwords/api/docs/guides/authentication

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ERROR_NOT_YET_IMPLEMENTED = fmt.Errorf("Not yet implemented")
)

exceptions

Functions

This section is empty.

Types

type AWQLQuery

type AWQLQuery struct {
	XMLName xml.Name
	Query   string `xml:"query"`
}

type AccountLabel

type AccountLabel struct {
	Id   int64  `xml:"id"`
	Name string `xml:"name"`
}

type AdError

type AdError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type AdGroup

type AdGroup struct {
	Id                           int64                          `xml:"id,omitempty"`
	CampaignId                   int64                          `xml:"campaignId,omitempty"`
	CampaignName                 string                         `xml:"campaignName,omitempty"`
	Name                         string                         `xml:"name,omitempty"`
	Status                       string                         `xml:"status,omitempty"`
	Settings                     []AdSetting                    `xml:"settings,omitempty"`
	BiddingStrategyConfiguration []BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration"`
	ContentBidCriterionTypeGroup *string                        `xml:"contentBidCriterionTypeGroup"`
	UrlCustomParameters          *CustomParameters              `xml:"urlCustomParameters"`
}

type AdGroupAdLabel

type AdGroupAdLabel struct {
	AdGroupAdId int64 `xml:"adGroupAdId"`
	LabelId     int64 `xml:"labelId"`
}

type AdGroupAdLabelOperations

type AdGroupAdLabelOperations map[string][]AdGroupAdLabel

type AdGroupAdOperations

type AdGroupAdOperations map[string]AdGroupAds

type AdGroupAdPolicySummary

type AdGroupAdPolicySummary struct {
	TopicEntries       []PolicyTopicEntry `xml:"policyTopicEntries,omitempty"`
	ReviewState        string             `xml:"reviewState,omitempty"`
	DenormalizedStatus string             `xml:"denormalizedStatus,omitempty"`
	ApprovalStatus     string             `xml:"combinedApprovalStatus,omitempty"`
}

type AdGroupAdService

type AdGroupAdService struct {
	Auth
}

func NewAdGroupAdService

func NewAdGroupAdService(auth *Auth) *AdGroupAdService

func (AdGroupAdService) Get

func (s AdGroupAdService) Get(selector Selector) (adGroupAds AdGroupAds, totalCount int64, err error)

Get returns an array of ad's and the total number of ad's matching the selector.

Example

ads, totalCount, err := adGroupAdService.Get(
  gads.Selector{
    Fields: []string{
      "AdGroupId",
      "Status",
      "AdGroupCreativeApprovalStatus",
      "AdGroupAdDisapprovalReasons",
      "AdGroupAdTrademarkDisapproved",
    },
    Predicates: []gads.Predicate{
      {"AdGroupId", "EQUALS", []string{adGroupId}},
    },
  },
)

Selectable fields are

"AdGroupId", "Id", "Url", "DisplayUrl", "CreativeFinalUrls", "CreativeFinalMobileUrls",
"CreativeFinalAppUrls", "CreativeTrackingUrlTemplate", "CreativeUrlCustomParameters",
"DevicePreference", "Status", "AdGroupCreativeApprovalStatus", "AdGroupAdDisapprovalReasons"
"AdGroupAdTrademarkDisapproved", "Labels"

TextAd
  "Headline", "Description1", "Description2"

ImageAd
  "ImageCreativeName"

filterable fields are

"AdGroupId", "Id", "Url", "DisplayUrl", "CreativeFinalUrls", "CreativeFinalMobileUrls",
"CreativeFinalAppUrls", "CreativeTrackingUrlTemplate", "CreativeUrlCustomParameters",
"DevicePreference", "Status", "AdGroupCreativeApprovalStatus", "AdGroupAdDisapprovalReasons"
"Labels"

TextAd specific fields
  "Headline", "Description1", "Description2"

ImageAd specific fields
  "ImageCreativeName"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService#get
Example
authConf, _ := NewCredentials(context.TODO())
agas := NewAdGroupAdService(&authConf.Auth)

// This example illustrates how to retrieve all text ads for an ad group.
adGroupId := "1"
var pageSize int64 = 500
var offset int64 = 0
paging := Paging{
	Offset: offset,
	Limit:  pageSize,
}
var totalCount int64 = 0
for {
	adGroupAds, totalCount, err := agas.Get(
		Selector{
			Fields: []string{
				"Id",
				"Status",
				"AdType",
			},
			Ordering: []OrderBy{
				{"Id", "ASCENDING"},
			},
			Predicates: []Predicate{
				{"AdGroupId", "IN", []string{adGroupId}},
				{"Status", "IN", []string{"ENABLED", "PAUSED", "DISABLED"}},
				{"AdType", "EQUALS", []string{"TEXT_AD"}},
			},
			Paging: &paging,
		},
	)
	if err != nil {
		fmt.Printf("Error occured finding ad group ad")
	}
	for _, aga := range adGroupAds {
		ta := aga.(TextAd)
		fmt.Printf("Ad ID is %d, type is 'TextAd' and status is '%s'", ta.Id, ta.Status)
	}
	// Increment values to request the next page.
	offset += pageSize
	paging.Offset = offset
	if totalCount < offset {
		break
	}
}
fmt.Printf("\tAd group ID %s has %d ad(s).", adGroupId, totalCount)
Output:

func (*AdGroupAdService) Mutate

func (s *AdGroupAdService) Mutate(adGroupAdOperations AdGroupAdOperations) (adGroupAds AdGroupAds, err error)

Mutate allows you to add, modify and remove ads, returning the modified ads.

Example

ads, err := adGroupAdService.Mutate(
  gads.AdGroupAdOperations{
    "ADD": {
      gads.NewTextAd(
        adGroup.Id,
        "https://classdo.com/en",
        "classdo.com",
        "test headline",
        "test line one",
        "test line two",
        "PAUSED",
      ),
    },
    "SET": {
      modifiedAd,
    },
    "REMOVE": {
      adNeedingRemoval,
    },
  },
)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService#mutate
Example
authConf, err := NewCredentials(context.TODO())
agas := NewAdGroupAdService(&authConf.Auth)

// This example illustrates how to add text ads to a given ad group.
var adGroupId int64 = 1

adGroupAds, err := agas.Mutate(
	AdGroupAdOperations{
		"ADD": {
			NewTextAd(
				adGroupId,
				"http://www.example.com",
				"example.com",
				"Luxury Cruise to Mars",
				"Visit the Red Planet in style.",
				"Low-gravity fun for everyone!",
				"ACTIVE",
			),
			NewTextAd(
				adGroupId,
				"http://www.example.com",
				"www.example.com",
				"Luxury Cruise to Mars",
				"Enjoy your stay at Red Planet.",
				"Buy your tickets now!",
				"ACTIVE",
			),
		},
	},
)
if err != nil {
	fmt.Printf("No ads were added.")
} else {
	fmt.Printf("Added %d ad(s) to ad group ID %d:", len(adGroupAds), adGroupId)
	for _, ada := range adGroupAds {
		ta := ada.(TextAd)
		fmt.Printf("\tAd ID %d, type 'TextAd' and status '%s'", ta.Id, ta.Status)
	}
}

// This example illustrates how to update an ad, setting its status to 'PAUSED'.
textAdId := adGroupAds[0].(TextAd).Id
adGroupAds, err = agas.Mutate(
	AdGroupAdOperations{
		"SET": {
			TextAd{
				AdGroupId: adGroupId,
				Id:        textAdId,
				Status:    "PAUSED",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No ads were updated.")
} else {
	textAd := adGroupAds[0].(TextAd)
	fmt.Printf("Ad ID %d was successfully updated, status set to '%s'.", textAd.Id, textAd.Status)
}

// This example removes an ad using the 'REMOVE' operator.
adGroupAds, err = agas.Mutate(
	AdGroupAdOperations{
		"SET": {
			TextAd{
				AdGroupId: adGroupId,
				Id:        textAdId,
				Status:    "REMOVE",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No ads were removed.")
} else {
	textAd := adGroupAds[0].(TextAd)
	fmt.Printf("Ad ID %d was successfully removed.", textAd.Id)
}
Output:

func (*AdGroupAdService) MutateLabel

func (s *AdGroupAdService) MutateLabel(adGroupAdLabelOperations AdGroupAdLabelOperations) (adGroupAdLabels []AdGroupAdLabel, err error)

MutateLabel allows you to add and removes labels from ads.

Example

ads, err := adGroupAdService.MutateLabel(
  gads.AdGroupAdLabelOperations{
    "ADD": {
      gads.AdGroupAdLabel{AdGroupAdId: 3200, LabelId: 5353},
      gads.AdGroupAdLabel{AdGroupAdId: 4320, LabelId: 5643},
    },
    "REMOVE": {
      gads.AdGroupAdLabel{AdGroupAdId: 3653, LabelId: 5653},
    },
  }

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService#mutateLabel

func (*AdGroupAdService) Query

func (s *AdGroupAdService) Query(query string) (adGroupAds AdGroupAds, totalCount int64, err error)

Query is not yet implemented

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService#query

type AdGroupAds

type AdGroupAds []interface{}

func (AdGroupAds) MarshalXML

func (a1 AdGroupAds) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*AdGroupAds) UnmarshalXML

func (aga *AdGroupAds) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type AdGroupBidLandscape

type AdGroupBidLandscape struct {
	BidLandscape
	Type             string  `xml:"type"`
	LandscapeCurrent bool    `xml:"landscapeCurrent"`
	Errors           []error `xml:"-"`
}

type AdGroupBidModifierService

type AdGroupBidModifierService struct {
	Auth
}

func NewAdGroupBidModifierService

func NewAdGroupBidModifierService(auth *Auth) *AdGroupBidModifierService

type AdGroupCriterionLabel

type AdGroupCriterionLabel struct {
	AdGroupCriterionId int64 `xml:"adGroupCriterionId"`
	LabelId            int64 `xml:"labelId"`
}

type AdGroupCriterionLabelOperations

type AdGroupCriterionLabelOperations map[string][]AdGroupCriterionLabel

type AdGroupCriterionOperations

type AdGroupCriterionOperations map[string]AdGroupCriterions

type AdGroupCriterionService

type AdGroupCriterionService struct {
	Auth
}

func NewAdGroupCriterionService

func NewAdGroupCriterionService(auth *Auth) *AdGroupCriterionService

func (AdGroupCriterionService) Get

func (s AdGroupCriterionService) Get(selector Selector) (adGroupCriterions AdGroupCriterions, totalCount int64, err error)

Get returns an array of AdGroupCriterion's and the total number of AdGroupCriterion's matching the selector.

Example

adGroupCriterions, totalCount, err := adGroupCriterionService.Get(
  Selector{
    Fields: []string{"Id","KeywordText","KeywordMatchType"},
    Predicates: []Predicate{
      {"AdGroupId", "EQUALS", []string{"432434"}},
    },
  },
)

Selectable fields are

"AdGroupId", "CriterionUse", "Id", "CriteriaType", "Labels"

AgeRange
  "AgeRangeType",

AppPaymentModel
  "AppPaymentModelType",

CriterionUserInterest
  "UserInterestId", "UserInterestName",

CriterionUserList
  "UserListId", "UserListName", "UserListMembershipStatus"

Gender
  "GenderType"

Keyword
  "KeywordText", "KeywordMatchType"

MobileAppCategory
  "MobileAppCategoryId"

MobileApplication
  "DisplayName"

Placement
  "PlacementUrl"

Product
  "Text"

ProductPartition
  "PartitionType", "ParentCriterionId", "CaseValue"

Vertical
  "VerticalId", "VerticalParentId", "Path"

Webpage
  "Parameter", "CriteriaCoverage", "CriteriaSamples"

filterable fields are

"AdGroupId", "CriterionUse", "Id", "CriteriaType", "Labels"

CriterionUserList
  "UserListMembershipStatus"

Keyword
  "KeywordText", "KeywordMatchType"

MobileApplication
  "DisplayName"

Placement
  "PlacementUrl"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#get
Example
authConf, _ := NewCredentials(context.TODO())
agcs := NewAdGroupCriterionService(&authConf.Auth)

// This example illustrates how to retrieve all keywords for an ad group.
adGroupId := "1"
var pageSize int64 = 500
var offset int64 = 0
paging := Paging{
	Offset: offset,
	Limit:  pageSize,
}
for {
	adGroupCriterions, totalCount, err := agcs.Get(
		Selector{
			Fields: []string{
				"Id",
				"CriteriaType",
				"KeywordText",
			},
			Ordering: []OrderBy{
				{"Id", "ASCENDING"},
			},
			Predicates: []Predicate{
				{"AdGroupId", "EQUALS", []string{adGroupId}},
				{"CriteriaType", "EQUALS", []string{"KEYWORD"}},
			},
			Paging: &paging,
		},
	)
	if err != nil {
		fmt.Printf("Error occured finding ad group criterion")
	}
	for _, agc := range adGroupCriterions {
		kc := agc.(BiddableAdGroupCriterion).Criterion.(KeywordCriterion)
		fmt.Printf("Keyword ID %d, type '%s' and text '%s'", kc.Id, kc.MatchType, kc.Text)
	}
	// Increment values to request the next page.
	offset += pageSize
	paging.Offset = offset
	if totalCount < offset {
		fmt.Printf("\tAd group ID %s has %d keyword(s).", adGroupId, totalCount)
		break
	}
}
Output:

func (*AdGroupCriterionService) Mutate

func (s *AdGroupCriterionService) Mutate(adGroupCriterionOperations AdGroupCriterionOperations) (adGroupCriterions AdGroupCriterions, err error)

Mutate allows you to add, modify and remove ad group criterion, returning the modified ad group criterion.

Example

ads, err := adGroupService.Mutate(
  gads.AdGroupCriterionOperations{
    "ADD": {
      BiddableAdGroupCriterion{
        AdGroupId:  adGroupId,
        Criterion:  gads.KeywordCriterion{Text: "test1", MatchType: "EXACT"},
        UserStatus: "PAUSED",
      },
      NegativeAdGroupCriterion{
        AdGroupId: adGroupId,
        Criterion: gads.KeywordCriterion{Text: "test4", MatchType: "BROAD"},
      },
    },
    "SET": {
      modifiedAdGroupCriterion,
    },
    "REMOVE": {
      adGroupCriterionNeedingRemoval,
    },
  },
)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#mutate
Example
authConf, err := NewCredentials(context.TODO())
agcs := NewAdGroupCriterionService(&authConf.Auth)

var adGroupId int64 = 1

// This example illustrates how to add multiple keywords to a given ad group.
adGroupCriterions, err := agcs.Mutate(
	AdGroupCriterionOperations{
		"ADD": {
			BiddableAdGroupCriterion{
				AdGroupId: adGroupId,
				Criterion: KeywordCriterion{
					Text:      "mars cruise",
					MatchType: "BROAD",
				},
				UserStatus: "PAUSED",
			},
			BiddableAdGroupCriterion{
				AdGroupId: adGroupId,
				Criterion: KeywordCriterion{
					Text:      "space hotel",
					MatchType: "BROAD",
				},
			},
		},
	},
)
if err != nil {
	fmt.Printf("No keywords were added.")
} else {
	fmt.Printf("Added %d keywords to ad group ID %d:", len(adGroupCriterions), adGroupId)
	for _, agc := range adGroupCriterions {
		k := agc.(BiddableAdGroupCriterion).Criterion.(KeywordCriterion)
		fmt.Printf("\tKeyword ID is %d and type is '%s'", k.Id, k.MatchType)
	}
}

// This example updates the bid of a keyword.
keywordCriterion := adGroupCriterions[0].(BiddableAdGroupCriterion).Criterion.(KeywordCriterion)
biddingStrategyConfigurations := BiddingStrategyConfiguration{
	Bids: []Bid{
		Bid{
			Type:   "CpcBid",
			Amount: 10000000,
		},
	},
}
adGroupCriterions, err = agcs.Mutate(
	AdGroupCriterionOperations{
		"SET": {
			BiddableAdGroupCriterion{
				AdGroupId:                    adGroupId,
				Criterion:                    keywordCriterion,
				BiddingStrategyConfiguration: &biddingStrategyConfigurations,
			},
		},
	},
)
biddableAdGroupCriterion := adGroupCriterions[0].(BiddableAdGroupCriterion)
keywordCriterion = biddableAdGroupCriterion.Criterion.(KeywordCriterion)
if err != nil {
	fmt.Printf("No keywords were updated.")
} else {
	fmt.Printf("Keyword ID %d was successfully updated, current bids are:", keywordCriterion.Id)
	for _, bid := range biddableAdGroupCriterion.BiddingStrategyConfiguration.Bids {
		fmt.Printf("\tType: '%s', value: %d", bid.Type, bid.Amount)
	}
}

// This example removes a keyword using the 'REMOVE' operator.
adGroupCriterions, err = agcs.Mutate(
	AdGroupCriterionOperations{
		"REMOVE": {
			BiddableAdGroupCriterion{
				AdGroupId: adGroupId,
				Criterion: keywordCriterion,
			},
		},
	},
)
if err != nil {
	fmt.Printf("No keywords were removed.")
} else {
	biddableAdGroupCriterion := adGroupCriterions[0].(BiddableAdGroupCriterion)
	keywordCriterion = biddableAdGroupCriterion.Criterion.(KeywordCriterion)
	fmt.Printf("Keyword ID %d was successfully removed.", keywordCriterion.Id)
}
Output:

func (*AdGroupCriterionService) MutateLabel

func (s *AdGroupCriterionService) MutateLabel(adGroupCriterionLabelOperations AdGroupCriterionLabelOperations) (adGroupCriterionLabels []AdGroupCriterionLabel, err error)

MutateLabel allows you to add and removes labels from ad groups.

Example

adGroupCriterions, err := adGroupCriterionService.MutateLabel(
  gads.AdGroupCriterionLabelOperations{
    "ADD": {
      gads.AdGroupCriterionLabel{AdGroupCriterionId: 3200, LabelId: 5353},
      gads.AdGroupCriterionLabel{AdGroupCriterionId: 4320, LabelId: 5643},
    },
    "REMOVE": {
      gads.AdGroupCriterionLabel{AdGroupCriterionId: 3653, LabelId: 5653},
    },
  },
)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#mutateLabel

func (*AdGroupCriterionService) Query

func (s *AdGroupCriterionService) Query(query string) (adGroupCriterions AdGroupCriterions, totalCount int64, err error)

Query documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#query

type AdGroupCriterions

type AdGroupCriterions []interface{}

func (*AdGroupCriterions) UnmarshalXML

func (agcs *AdGroupCriterions) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type AdGroupEstimate

type AdGroupEstimate struct {
	KeywordEstimates []KeywordEstimate `xml:"keywordEstimates"`
}

type AdGroupEstimateRequest

type AdGroupEstimateRequest struct {
	KeywordEstimateRequests []KeywordEstimateRequest `xml:"keywordEstimateRequests"`
	MaxCpc                  int64                    `xml:"https://adwords.google.com/api/adwords/cm/v201809 maxCpc>microAmount"`
}

type AdGroupExperimentData

type AdGroupExperimentData struct {
	ExperimentId          int64  `xml:"experimentId"`
	ExperimentDeltaStatus string `xml:"experimentDeltaStatus"`
	ExperimentDataStatus  string `xml:"experimentDataStatus"`
}

type AdGroupExtensionSetting

type AdGroupExtensionSetting struct {
	AdGroupId        int64            `xml:"https://adwords.google.com/api/adwords/cm/v201809 adGroupId,omitempty"`
	ExtensionType    FeedType         `xml:"https://adwords.google.com/api/adwords/cm/v201809 extensionType,omitempty"`
	ExtensionSetting ExtensionSetting `xml:"https://adwords.google.com/api/adwords/cm/v201809 extensionSetting,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.AdGroupExtensionSetting An AdGroupExtensionSetting is used to add or modify extensions being served for the specified ad group.

type AdGroupExtensionSettingOperations

type AdGroupExtensionSettingOperations map[string][]AdGroupExtensionSetting

type AdGroupFeed

type AdGroupFeed struct {
}

type AdGroupFeedOperations

type AdGroupFeedOperations struct {
}

type AdGroupFeedService

type AdGroupFeedService struct {
	Auth
}

func NewAdGroupFeedService

func NewAdGroupFeedService(auth *Auth) *AdGroupFeedService

func (AdGroupFeedService) Get

func (s AdGroupFeedService) Get(selector Selector) (adGroupFeeds []AdGroupFeed, err error)

Get is not yet implemented

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupFeedService#get

func (*AdGroupFeedService) Mutate

func (s *AdGroupFeedService) Mutate(adGroupFeedOperations AdGroupFeedOperations) (adGroupFeeds []AdGroupFeed, err error)

Mutate is not yet implemented

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupFeedService#mutate

func (*AdGroupFeedService) Query

func (s *AdGroupFeedService) Query(query string) (adGroupFeeds []AdGroupFeed, err error)

Query is not yet implemented

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupFeedService#query

type AdGroupLabel

type AdGroupLabel struct {
	AdGroupId int64 `xml:"adGroupId"`
	LabelId   int64 `xml:"labelId"`
}

type AdGroupLabelOperations

type AdGroupLabelOperations map[string][]AdGroupLabel

type AdGroupOperations

type AdGroupOperations map[string][]AdGroup

type AdGroupService

type AdGroupService struct {
	Auth
}

func NewAdGroupService

func NewAdGroupService(auth *Auth) *AdGroupService

func (*AdGroupService) Get

func (s *AdGroupService) Get(selector Selector) (adGroups []AdGroup, totalCount int64, err error)

Get returns an array of ad group's and the total number of ad group's matching the selector.

Example

ads, totalCount, err := adGroupService.Get(
  gads.Selector{
    Fields: []string{
      "Id",
      "CampaignId",
      "CampaignName",
      "Name",
      "Status",
      "Settings",
      "Labels",
      "ContentBidCriterionTypeGroup",
      "TrackingUrlTemplate",
      "UrlCustomParameters",
    },
    Predicates: []gads.Predicate{
      {"Id", "EQUALS", []string{adGroupId}},
    },
  },
)

Selectable fields are

"Id", "CampaignId", "CampaignName", "Name", "Status", "Settings", "Labels"
"ContentBidCriterionTypeGroup", "TrackingUrlTemplate", "UrlCustomParameters"

filterable fields are

"Id", "CampaignId", "CampaignName", "Name", "Status", "Labels"
"ContentBidCriterionTypeGroup", "TrackingUrlTemplate"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupService#get
Example
authConf, _ := NewCredentials(context.TODO())
ags := NewAdGroupService(&authConf.Auth)

// This example illustrates how to retrieve all the ad groups for a campaign.
campaignId := "3"
var pageSize int64 = 500
var offset int64 = 0
paging := Paging{
	Offset: offset,
	Limit:  pageSize,
}
totalCount := 0
for {
	adGroups, totalCount, err := ags.Get(
		Selector{
			Fields: []string{
				"Id",
				"Name",
			},
			Ordering: []OrderBy{
				{"Name", "ASCENDING"},
			},
			Predicates: []Predicate{
				{"CampaignId", "IN", []string{campaignId}},
			},
			Paging: &paging,
		},
	)
	if err != nil {
		fmt.Printf("Error occured finding ad group")
	}
	for _, ag := range adGroups {
		fmt.Printf("Ad group name is '%d' and ID is %s", ag.Id, ag.Name)
	}
	// Increment values to request the next page.
	offset += pageSize
	paging.Offset = offset
	if totalCount < offset {
		break
	}
}
fmt.Printf("\tCampaign ID %s has %d ad group(s).", campaignId, totalCount)
Output:

func (*AdGroupService) Mutate

func (s *AdGroupService) Mutate(adGroupOperations AdGroupOperations) (adGroups []AdGroup, err error)

Mutate allows you to add, modify and remove ad group's, returning the modified ad group's.

Example

ads, err := adGroupService.Mutate(
  gads.AdGroupOperations{
    "ADD": {
      gads.AdGroup{
        Name:       "my ad group ",
        Status:     "PAUSED",
        CampaignId:  campaignId,
        BiddingStrategyConfiguration: []gads.BiddingStrategyConfiguration{
          gads.BiddingStrategyConfiguration{
            StrategyType: "NONE",
            Bids: []gads.Bid{
              gads.Bid{
                Type:   "CpcBid",
                Amount: 10000,
              },
            },
          },
        },
      },
    },
    "SET": {
      modifiedAdGroup,
    },
    "REMOVE": {
      adGroupNeedingRemoval,
    },
  },
)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupService#mutate
Example
authConf, err := NewCredentials(context.TODO())
ags := NewAdGroupService(&authConf.Auth)

var campaignId int64 = 1

// This example illustrates how to create ad groups.
adGroups, err := ags.Mutate(
	AdGroupOperations{
		"ADD": {
			AdGroup{
				Name:       fmt.Sprintf("Earth to Mars Cruises #%d", time.Now().Unix()),
				Status:     "ENABLED",
				CampaignId: campaignId,
				BiddingStrategyConfiguration: []BiddingStrategyConfiguration{
					{
						Bids: []Bid{
							Bid{
								Type:   "CpcBid",
								Amount: 10000000,
							},
						},
					},
				},
				Settings: []AdSetting{
					AdSetting{
						Details: []TargetSettingDetail{
							TargetSettingDetail{
								CriterionTypeGroup: "PLACEMENT",
								TargetAll:          true,
							},
							TargetSettingDetail{
								CriterionTypeGroup: "VERTICAL",
								TargetAll:          false,
							},
						},
					},
				},
			},
			AdGroup{
				Name:       fmt.Sprintf("Earth to Pluto Cruises #%d", time.Now().Unix()),
				Status:     "ENABLED",
				CampaignId: campaignId,
				BiddingStrategyConfiguration: []BiddingStrategyConfiguration{
					{
						Bids: []Bid{
							Bid{
								Type:   "CpcBid",
								Amount: 10000000,
							},
						},
					},
				},
			},
		},
	},
)
if err != nil {
	fmt.Printf("")
} else {
	for _, ag := range adGroups {
		fmt.Printf("Ad group ID %d was successfully added.", ag.Id)
	}
}

// This example illustrates how to update an ad group
adGroups, err = ags.Mutate(
	AdGroupOperations{
		"SET": {
			AdGroup{
				Id:     adGroups[0].Id,
				Status: "PAUSE",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No ad groups were updated.")
} else {
	fmt.Printf("Ad group id %d was successfully updated.", adGroups[0].Id)
}

// This example removes an ad group by setting the status to 'REMOVED'.
adGroups, err = ags.Mutate(
	AdGroupOperations{
		"SET": {
			AdGroup{
				Id:     adGroups[0].Id,
				Status: "REMOVE",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No ad groups were updated.")
} else {
	fmt.Printf("Ad group id %d was successfully removed.", adGroups[0].Id)
}
Output:

func (*AdGroupService) MutateLabel

func (s *AdGroupService) MutateLabel(adGroupLabelOperations AdGroupLabelOperations) (adGroupLabels []AdGroupLabel, err error)

MutateLabel allows you to add and removes labels from ad groups.

Example

adGroups, err := adGroupService.MutateLabel(
  gads.AdGroupLabelOperations{
    "ADD": {
      gads.AdGroupLabel{AdGroupId: 3200, LabelId: 5353},
      gads.AdGroupLabel{AdGroupId: 4320, LabelId: 5643},
    },
    "REMOVE": {
      gads.AdGroupLabel{AdGroupId: 3653, LabelId: 5653},
    },
  }

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupService#mutateLabel

func (*AdGroupService) Query

func (s *AdGroupService) Query(query string) (adGroups []AdGroup, totalCount int64, err error)

Query documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupService#query

type AdGroupServiceError

type AdGroupServiceError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type AdParam

type AdParam struct {
}

type AdParamService

type AdParamService struct {
	Auth
}

func NewAdParamService

func NewAdParamService(auth *Auth) *AdParamService

func (AdParamService) Get

func (s AdParamService) Get(selector Selector) (adParams []AdParam, err error)

Query is not yet implemented

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdParamService#get

type AdScheduleCriterion

type AdScheduleCriterion struct {
	Id          int64  `xml:"id,omitempty"`
	DayOfWeek   string `xml:"dayOfWeek"`
	StartHour   string `xml:"startHour"`
	StartMinute string `xml:"startMinute"`
	EndHour     string `xml:"endHour"`
	EndMinute   string `xml:"endMinute"`
}

DayOfWeek: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY StartHour: 0~23 inclusive StartMinute: ZERO, FIFTEEN, THIRTY, FORTY_FIVE EndHour: 0~24 inclusive EndMinute: ZERO, FIFTEEN, THIRTY, FORTY_FIVE

type AdSetting

type AdSetting struct {
	XMLName xml.Name `xml:"settings"`
	Type    string   `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`

	OptIn   *bool                 `xml:"optIn"`
	Details []TargetSettingDetail `xml:"details"`
}

type AdUrlUpgrade

type AdUrlUpgrade struct {
	AdId                int64  `xml:"adId"`
	FinalUrl            string `xml:"finalUrl"`
	FinalMobileUrl      string `xml:"finalMobileUrl"`
	TrackingUrlTemplate string `xml:"trackingUrlTemplate"`
}

type Address

type Address struct {
	StreetAddress  string `xml:"streetAddress"`
	StreetAddress2 string `xml:"streetAddress2"`
	CityName       string `xml:"cityName"`
	ProvinceCode   string `xml:"provinceCode"`
	ProvinceName   string `xml:"provinceName"`
	PostalCode     string `xml:"postalCode"`
	CountryCode    string `xml:"countryCode"`
}

type AddressInfo

type AddressInfo struct {
	FirstName   string `xml:"hashedFirstName"`
	LastName    string `xml:"hashedLastName"`
	CountryCode string `xml:"countryCode"`
	ZipCode     string `xml:"zipCode"`
}

AddressInfo is an address identifier of a user list member. Accessible for whitelisted customers only.

type AdwordsUserListService

type AdwordsUserListService struct {
	Auth
}

func NewAdwordsUserListService

func NewAdwordsUserListService(auth *Auth) *AdwordsUserListService

func (AdwordsUserListService) Get

func (s AdwordsUserListService) Get(selector Selector) (userLists []UserList, err error)

Get returns an array of adwords user lists and the total number of adwords user lists matching the selector.

Example

ads, totalCount, err := adwordsUserListService.Get(
  gads.Selector{
    Fields: []string{
      "Id",
      "Name",
      "Status",
      "Labels",
    },
    Predicates: []gads.Predicate{
      {"Id", "EQUALS", []string{adGroupId}},
    },
  },
)

Selectable fields are

"Id", "IsReadOnly", "Name", "Description", "Status", "IntegrationCode", "AccessReason",
"AccountUserListStatus", "MembershipLifeSpan", "Size", "SizeRange", "SizeForSearch",
"SizeRangeForSearch", "ListType"

BasicUserList
  "ConversionType"

LogicalUserList
  "Rules"

SimilarUserList
  "SeedUserListId", "SeedUserListName", "SeedUserListDescription", "SeedUserListStatus",
  "SeedListSize"

filterable fields are

"Id", "Name", "Status", "IntegrationCode", "AccessReason", "AccountUserListStatus",
"MembershipLifeSpan", "Size", "SizeForSearch", "ListType"

SimilarUserList
  "SeedUserListId", "SeedListSize"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService#get

func (*AdwordsUserListService) Mutate

func (s *AdwordsUserListService) Mutate(userListOperations UserListOperations) (adwordsUserLists []UserList, err error)

Mutate adds/sets a collection of user lists. Returns a list of User Lists

Example

auls := gads.NewAdwordsUserListService(&config.Auth)

crmList := gads.NewCrmBasedUserList("Test List", "Just a list to test with", 0, "http://mytest.com/optout")

ops := gads.UserListOperations{
	Operations: []gads.Operation{
		gads.Operation{
			Operator: "ADD",
			Operand: crmList,
		},
	},
}

resp, err := auls.Mutate(ops)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService#mutate

func (*AdwordsUserListService) MutateMembers

func (s *AdwordsUserListService) MutateMembers(mutateMembersOperations MutateMembersOperations) (adwordsUserLists []UserList, err error)
mutateMembersOperations := gads.MutateMembersOperations{
	Operations: []gads.Operation{
		gads.Operation{
			Operator: "ADD",
			Operand: mmo,
		},
	},
}

auls.MutateMembers(mutateMembersOperations)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService#mutateMembers

type AgeRangeCriterion

type AgeRangeCriterion struct {
	Id           int64  `xml:"id,omitempty"`
	AgeRangeType string `xml:"ageRangeType"`
}

AgeRangeType: AGE_RANGE_18_24, AGE_RANGE_25_34, AGE_RANGE_35_44, AGE_RANGE_45_54, AGE_RANGE_55_64, AGE_RANGE_65_UP, AGE_RANGE_UNDETERMINED, UNKNOWN

type ApiExceptionFault

type ApiExceptionFault struct {
	Message string        `xml:"message"`
	Type    string        `xml:"ApplicationException.Type"`
	Errors  []interface{} `xml:"errors"`
}

func (*ApiExceptionFault) UnmarshalXML

func (aes *ApiExceptionFault) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) (err error)

type AppUrl

type AppUrl struct {
	Url    string `xml:"url"`
	OsType string `xml:"osType"` // "OS_TYPE_IOS", "OS_TYPE_ANDROID", "UNKNOWN"
}

type Attribute

type Attribute interface{}

type Auth

type Auth struct {
	CustomerId     string
	DeveloperToken string
	UserAgent      string
	PartialFailure bool
	Testing        *testing.T   `json:"-"`
	Client         *http.Client `json:"-"`
}

type AuthConfig

type AuthConfig struct {
	OAuth2Config *oauth2.Config `json:"oauth2.Config"`
	OAuth2Token  *oauth2.Token  `json:"oauth2.Token"`

	Auth Auth `json:"gads.Auth"`
	// contains filtered or unexported fields
}

func NewCredentials

func NewCredentials(ctx context.Context) (ac AuthConfig, err error)

func NewCredentialsFromFile

func NewCredentialsFromFile(pathToFile string, ctx context.Context) (ac AuthConfig, err error)

func NewCredentialsFromParams

func NewCredentialsFromParams(creds Credentials) (config AuthConfig, err error)

func NewCredentialsRaw

func NewCredentialsRaw(ctx context.Context, token *oauth2.Token, config *oauth2.Config) (ac AuthConfig)

func (AuthConfig) Save

func (c AuthConfig) Save() error

Save writes the contents of AuthConfig back to the JSON file it was loaded from.

func (AuthConfig) Token

func (c AuthConfig) Token() (token *oauth2.Token, err error)

Token implements oauth2.TokenSource interface and store updates to config file.

type AuthenticationError

type AuthenticationError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type BatchJob

type BatchJob struct {
	Id               int64                    `xml:"id,omitempty" json:",string"`
	Status           string                   `xml:"status,omitempty"`
	ProgressStats    *ProgressStats           `xml:"progressStats,omitempty"`
	UploadUrl        *TemporaryUrl            `xml:"uploadUrl,omitempty"`
	DownloadUrl      *TemporaryUrl            `xml:"downloadUrl,omitempty"`
	ProcessingErrors *BatchJobProcessingError `xml:"processingErrors,omitempty"`
}

type BatchJobHelper

type BatchJobHelper struct {
	Auth
}

func NewBatchJobHelper

func NewBatchJobHelper(auth *Auth) *BatchJobHelper

func (*BatchJobHelper) DownloadBatchJob

func (s *BatchJobHelper) DownloadBatchJob(url TemporaryUrl) (mutateResults []MutateResults, err error)

DownloadBatchJob download batch operations from an BatchJob.DownloadUrl from BatchJobService.Get

Example

mutateResult, err := batchJobHelper.DownloadBatchJob(*batchJobs.BatchJobs[0].DownloadUrl)

https://developers.google.com/adwords/api/docs/guides/batch-jobs?hl=en#download_the_batch_job_results_and_check_for_errors

func (*BatchJobHelper) UploadBatchJobOperations

func (s *BatchJobHelper) UploadBatchJobOperations(jobOperations []interface{}, url TemporaryUrl) (err error)

UploadBatchJobOperations uploads batch operations to an BatchJob.UploadUrl from BatchJobService.Mutate

Example

ago := gads.AdGroupOperations{
		"ADD": {
			gads.AdGroup{
				Name:       "test ad group " + rand_str(10),
				Status:     "PAUSED",
				CampaignId: campaignId,
			},
			gads.AdGroup{
				Name:       "test ad group " + rand_str(10),
				Status:     "PAUSED",
				CampaignId: campaignId,
			},
		},
	}

var operations []interface{} operations = append(operations, ago) err = batchJobHelper.UploadBatchJobOperations(operations, UploadUrl)

https://developers.google.com/adwords/api/docs/guides/batch-jobs?hl=en#upload_operations_to_the_upload_url

type BatchJobOperation

type BatchJobOperation struct {
	Operator string   `xml:"operator"`
	Operand  BatchJob `xml:"operand"`
}

type BatchJobOperations

type BatchJobOperations struct {
	BatchJobOperations []BatchJobOperation
}

type BatchJobPage

type BatchJobPage struct {
	TotalNumEntries int        `xml:"rval>totalNumEntries"`
	BatchJobs       []BatchJob `xml:"rval>entries"`
}

type BatchJobProcessingError

type BatchJobProcessingError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type BatchJobService

type BatchJobService struct {
	Auth
}

func NewBatchJobService

func NewBatchJobService(auth *Auth) *BatchJobService

func (*BatchJobService) Get

func (s *BatchJobService) Get(selector Selector) (batchJobPage BatchJobPage, err error)

Get queries the status of existing BatchJobs

Example

batchJobs, err := batchJobService.Get(
	gads.Selector{
		Fields: []string{
			"Id",
			"Status",
			"DownloadUrl",
			"ProcessingErrors",
			"ProgressStats",
		},
		Predicates: []gads.Predicate{
			{"Id", "EQUALS", []string{strconv.FormatInt(jobId, 10)}},
		},
	},
)

https://developers.google.com/adwords/api/docs/reference/v201809/BatchJobService#get

func (*BatchJobService) Mutate

func (s *BatchJobService) Mutate(batchJobOperations BatchJobOperations) (batchJobs []BatchJob, err error)

Mutate allows you to create or update a BatchJob

Example

resp, err := batchJobService.Mutate(
	gads.BatchJobOperations{
		BatchJobOperations: []gads.BatchJobOperation{
			gads.BatchJobOperation{
				Operator: "ADD",
				Operand: gads.BatchJob{},
			},
		},
	},
)

https://developers.google.com/adwords/api/docs/reference/v201809/BatchJobService#mutate

func (*BatchJobService) Query

func (s *BatchJobService) Query()

type Bid

type Bid struct {
	Type         string  `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
	Amount       int64   `xml:"bid>microAmount"`
	CpcBidSource *string `xml:"cpcBidSource"`
	CpmBidSource *string `xml:"cpmBidSource"`
}

type BidLandscape

type BidLandscape struct {
	CampaignId      *int64           `xml:"campaignId,omitempty"`
	AdGroupId       *int64           `xml:"adGroupId,omitempty"`
	StartDate       *string          `xml:"startDate,omitempty"`
	EndDate         *string          `xml:"endDate,omitempty"`
	LandscapePoints []LandscapePoint `xml:"landscapePoints"`
}

type BiddableAdGroupCriterion

type BiddableAdGroupCriterion struct {
	AdGroupId    int64     `xml:"adGroupId"`
	CriterionUse string    `xml:"criterionUse"`
	Criterion    Criterion `xml:"criterion"`

	// BiddableAdGroupCriterion
	UserStatus          string   `xml:"userStatus,omitempty"`
	SystemServingStatus string   `xml:"systemServingStatus,omitempty"`
	ApprovalStatus      string   `xml:"approvalStatus,omitempty"`
	DisapprovalReasons  []string `xml:"disapprovalReasons,omitempty"`

	// TODO add ExperimentData
	FirstPageCpc *Cpc `xml:"firstPageCpc,omitempty"`
	TopOfPageCpc *Cpc `xml:"topOfPageCpc,omitempty"`

	QualityInfo *QualityInfo `xml:"qualityInfo,omitempty"`

	BiddingStrategyConfiguration *BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration,omitempty"`
	BidModifier                  int64                         `xml:"bidModifier,omitempty"`

	FinalUrls           []string         `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string         `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []string         `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string           `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters CustomParameters `xml:"urlCustomParameters,omitempty"`
	Labels              []Label          `xml:"labels,omitempty"`
}

func (BiddableAdGroupCriterion) MarshalXML

func (bagc BiddableAdGroupCriterion) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*BiddableAdGroupCriterion) UnmarshalXML

func (bagc *BiddableAdGroupCriterion) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type BiddingScheme

type BiddingScheme struct {
	Type               string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
	EnhancedCpcEnabled bool   `xml:"enhancedCpcEnabled"`
}

type BiddingStrategyConfiguration

type BiddingStrategyConfiguration struct {
	StrategyId     int64          `xml:"biddingStrategyId,omitempty"`
	StrategyName   string         `xml:"biddingStrategyName,omitempty"`
	StrategyType   string         `xml:"biddingStrategyType,omitempty"`
	StrategySource string         `xml:"biddingStrategySource,omitempty"`
	Scheme         *BiddingScheme `xml:"biddingScheme,omitempty"`
	Bids           []Bid          `xml:"bids"`
}

type BiddingStrategyService

type BiddingStrategyService struct {
	Auth
}

func NewBiddingStrategyService

func NewBiddingStrategyService(auth *Auth) *BiddingStrategyService

type BooleanAttribute

type BooleanAttribute struct {
	Value bool `xml:"value"`
}

type Budget

type Budget struct {
	Id         int64  `xml:"budgetId,omitempty"`           // A unique identifier
	Name       string `xml:"name"`                         // A descriptive name
	Period     string `xml:"period"`                       // The period to spend the budget
	Amount     int64  `xml:"amount>microAmount"`           // The amount in cents
	Delivery   string `xml:"deliveryMethod"`               // The rate at which the budget spent. valid options are STANDARD or ACCELERATED.
	References int64  `xml:"referenceCount,omitempty"`     // The number of campaigns using the budget
	Shared     bool   `xml:"isExplicitlyShared,omitempty"` // If this budget was created to be shared across campaigns
	Status     string `xml:"status,omitempty"`             // The status of the budget. can be ENABLED, REMOVED, UNKNOWN
}

A Budget represents an allotment of money to be spent over a fixed period of time.

type BudgetError

type BudgetError struct {
	EntityError
}

type BudgetOperations

type BudgetOperations map[string][]Budget

A BudgetOperations maps operations to the budgets they will be performed on. Budgets operations can be 'ADD', 'REMOVE' or 'SET'

type BudgetOrderService

type BudgetOrderService struct {
	Auth
}

func NewBudgetOrderService

func NewBudgetOrderService(auth *Auth) *BudgetOrderService

type BudgetService

type BudgetService struct {
	Auth
}

A budgetService holds the connection information for the budget service.

func NewBudgetService

func NewBudgetService(auth *Auth) *BudgetService

NewBudgetService creates a new budgetService

func (*BudgetService) Get

func (s *BudgetService) Get(selector Selector) (budgets []Budget, totalCount int64, err error)

Get returns budgets matching a given selector and the total count of matching budgets.

func (*BudgetService) Mutate

func (s *BudgetService) Mutate(budgetOperations BudgetOperations) (budgets []Budget, err error)

Mutate takes a budgetOperations and creates, modifies or destroys the associated budgets.

type CallConversionType

type CallConversionType struct {
	ConversionTypeId int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 conversionTypeId,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.CallConversionType Conversion type for a call extension.

type CallFeedItem

type CallFeedItem struct {
	ExtensionFeedItem

	CallPhoneNumber               string             `xml:"https://adwords.google.com/api/adwords/cm/v201809 callPhoneNumber,omitempty"`
	CallCountryCode               string             `xml:"https://adwords.google.com/api/adwords/cm/v201809 callCountryCode,omitempty"`
	CallTracking                  bool               `xml:"https://adwords.google.com/api/adwords/cm/v201809 callTracking,omitempty"`
	CallConversionType            CallConversionType `xml:"https://adwords.google.com/api/adwords/cm/v201809 callConversionType,omitempty"`
	DisableCallConversionTracking bool               `xml:"https://adwords.google.com/api/adwords/cm/v201809 disableCallConversionTracking,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.CallFeedItem Represents a Call extension.

type Campaign

type Campaign struct {
	Id                             int64                           `xml:"id,omitempty"`
	Name                           string                          `xml:"name"`
	Status                         string                          `xml:"status"`                  // Status: "ENABLED", "PAUSED", "REMOVED"
	ServingStatus                  *string                         `xml:"servingStatus,omitempty"` // ServingStatus: "SERVING", "NONE", "ENDED", "PENDING", "SUSPENDED"
	StartDate                      string                          `xml:"startDate"`
	EndDate                        *string                         `xml:"endDate,omitempty"`
	BudgetId                       int64                           `xml:"budget>budgetId"`
	ConversionOptimizerEligibility *conversionOptimizerEligibility `xml:"conversionOptimizerEligibility"`
	AdServingOptimizationStatus    string                          `xml:"adServingOptimizationStatus,omitempty"`
	FrequencyCap                   *FrequencyCap                   `xml:"frequencyCap"`
	Settings                       []CampaignSetting               `xml:"settings"`
	AdvertisingChannelType         string                          `xml:"advertisingChannelType,omitempty"`    // "UNKNOWN", "SEARCH", "DISPLAY", "SHOPPING"
	AdvertisingChannelSubType      *string                         `xml:"advertisingChannelSubType,omitempty"` // "UNKNOWN", "SEARCH_MOBILE_APP", "DISPLAY_MOBILE_APP", "SEARCH_EXPRESS", "DISPLAY_EXPRESS"
	NetworkSetting                 *NetworkSetting                 `xml:"networkSetting"`
	Labels                         []Label                         `xml:"labels"`
	BiddingStrategyConfiguration   *BiddingStrategyConfiguration   `xml:"biddingStrategyConfiguration"`
	ForwardCompatibilityMap        *map[string]string              `xml:"forwardCompatibilityMap,omitempty"`
	TrackingUrlTemplate            *string                         `xml:"trackingUrlTemplate"`
	UrlCustomParameters            *CustomParameters               `xml:"urlCustomParameters"`
	Errors                         []error                         `xml:"-"`
}

type CampaignAdExtensionService

type CampaignAdExtensionService struct {
	Auth
}

func NewCampaignAdExtensionService

func NewCampaignAdExtensionService(auth *Auth) *CampaignAdExtensionService

type CampaignCriterion

type CampaignCriterion struct {
	CampaignId  int64     `xml:"campaignId"`
	IsNegative  bool      `xml:"isNegative,omitempty"`
	Criterion   Criterion `xml:"criterion"`
	BidModifier *float64  `xml:"bidModifier,omitempty"`
	Errors      []error   `xml:"-"`
}

func (CampaignCriterion) MarshalXML

func (cc CampaignCriterion) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type CampaignCriterionOperations

type CampaignCriterionOperations map[string]CampaignCriterions

type CampaignCriterionService

type CampaignCriterionService struct {
	Auth
}

func NewCampaignCriterionService

func NewCampaignCriterionService(auth *Auth) *CampaignCriterionService

func (*CampaignCriterionService) Get

func (s *CampaignCriterionService) Get(selector Selector) (campaignCriterions CampaignCriterions, totalCount int64, err error)

func (*CampaignCriterionService) Mutate

func (s *CampaignCriterionService) Mutate(campaignCriterionOperations CampaignCriterionOperations) (campaignCriterions CampaignCriterions, err error)

func (*CampaignCriterionService) Query

func (s *CampaignCriterionService) Query(query string) (campaignCriterions CampaignCriterions, totalCount int64, err error)

type CampaignCriterions

type CampaignCriterions []interface{}

func (*CampaignCriterions) UnmarshalXML

func (ccs *CampaignCriterions) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type CampaignEstimate

type CampaignEstimate struct {
	AdGroupEstimates []AdGroupEstimate `xml:"adGroupEstimates"`
}

type CampaignEstimateRequest

type CampaignEstimateRequest struct {
	AdGroupEstimateRequests []AdGroupEstimateRequest `xml:"adGroupEstimateRequests"`
}

type CampaignExtensionSetting

type CampaignExtensionSetting struct {
	CampaignId       int64            `xml:"https://adwords.google.com/api/adwords/cm/v201809 campaignId,omitempty"`
	ExtensionType    FeedType         `xml:"https://adwords.google.com/api/adwords/cm/v201809 extensionType,omitempty"`
	ExtensionSetting ExtensionSetting `xml:"https://adwords.google.com/api/adwords/cm/v201809 extensionSetting,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/CampaignExtensionSettingService.CampaignExtensionSetting A CampaignExtensionSetting is used to add or modify extensions being served for the specified campaign.

type CampaignExtensionSettingOperations

type CampaignExtensionSettingOperations map[string][]CampaignExtensionSetting

type CampaignFeedService

type CampaignFeedService struct {
	Auth
}

func NewCampaignFeedService

func NewCampaignFeedService(auth *Auth) *CampaignFeedService

type CampaignLabel

type CampaignLabel struct {
	CampaignId int64 `xml:"campaignId"`
	LabelId    int64 `xml:"labelId"`
}

type CampaignLabelOperations

type CampaignLabelOperations map[string][]CampaignLabel

type CampaignOperations

type CampaignOperations map[string][]Campaign

type CampaignService

type CampaignService struct {
	Auth
}

A campaignService holds the connection information for the campaign service.

func NewCampaignService

func NewCampaignService(auth *Auth) *CampaignService

NewCampaignService creates a new campaignService

func (*CampaignService) Get

func (s *CampaignService) Get(selector Selector) (campaigns []Campaign, totalCount int64, err error)

Get returns an array of Campaign's and the total number of campaign's matching the selector.

Example

campaigns, totalCount, err := campaignService.Get(
  gads.Selector{
    Fields: []string{
      "AdGroupId",
      "Status",
      "AdGroupCreativeApprovalStatus",
      "AdGroupAdDisapprovalReasons",
      "AdGroupAdTrademarkDisapproved",
    },
    Predicates: []gads.Predicate{
      {"AdGroupId", "EQUALS", []string{adGroupId}},
    },
  },
)

Selectable fields are

"Id", "Name", "Status", "ServingStatus", "StartDate", "EndDate", "AdServingOptimizationStatus",
"Settings", "AdvertisingChannelType", "AdvertisingChannelSubType", "Labels", "TrackingUrlTemplate",
"UrlCustomParameters"

filterable fields are

"Id", "Name", "Status", "ServingStatus", "StartDate", "EndDate", "AdvertisingChannelType",
"AdvertisingChannelSubType", "Labels", "TrackingUrlTemplate"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService#get
Example
// load credentials from
authConf, _ := NewCredentials(context.TODO())
cs := NewCampaignService(&authConf.Auth)

// This example illustrates how to retrieve all the campaigns for an account.
var pageSize int64 = 500
var offset int64 = 0
paging := Paging{
	Offset: offset,
	Limit:  pageSize,
}
totalCount := 0
for {
	campaigns, totalCount, err := cs.Get(
		Selector{
			Fields: []string{
				"Id",
				"Name",
				"Status",
			},
			Ordering: []OrderBy{
				{"Name", "ASCENDING"},
			},
			Paging: &paging,
		},
	)
	if err != nil {
		fmt.Printf("Error occured finding campaigns")
	}
	for _, c := range campaigns {
		fmt.Printf("Campaign ID %d, name '%s' and status '%s'", c.Id, c.Name, c.Status)
	}
	// Increment values to request the next page.
	offset += pageSize
	paging.Offset = offset
	if totalCount < offset {
		break
	}
}
fmt.Printf("\tTotal number of campaigns found: %d.", totalCount)
Output:

func (*CampaignService) Mutate

func (s *CampaignService) Mutate(campaignOperations CampaignOperations) (campaigns []Campaign, err error)

Mutate allows you to add and modify campaigns, returning the campaigns. Note that the "REMOVE" operator is not supported. To remove a campaign set its Status to "REMOVED".

Example

campaignNeedingRemoval.Status = "REMOVED"
ads, err := campaignService.Mutate(
  gads.CampaignOperations{
    "ADD": {
      gads.Campaign{
        Name: "my campaign name",
        Status: "PAUSED",
        StartDate: time.Now().Format("20060102"),
        BudgetId: 321543214,
        AdServingOptimizationStatus: "ROTATE_INDEFINITELY",
        Settings: []gads.CampaignSetting{
          gads.NewRealTimeBiddingSetting(true),
        },
        AdvertisingChannelType: "SEARCH",
        BiddingStrategyConfiguration: &gads.BiddingStrategyConfiguration{
          StrategyType: "MANUAL_CPC",
        },
      },
      campaignNeedingRemoval,
    },
    "SET": {
      modifiedCampaign,
    },
  }

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService#mutate
Example
// load credentials from
authConf, err := NewCredentials(context.TODO())
cs := NewCampaignService(&authConf.Auth)

var budgetId int64 = 1

// This example illustrates how to create campaigns.
campaigns, err := cs.Mutate(
	CampaignOperations{
		"ADD": {
			Campaign{
				Name:   fmt.Sprintf("Interplanetary Cruise #%d", time.Now().Unix()),
				Status: "ACTIVE",
				BiddingStrategyConfiguration: &BiddingStrategyConfiguration{
					StrategyType: "MANUAL_CPC",
				},
				// Budget (required) - note only the budget ID is required
				BudgetId:               budgetId,
				AdvertisingChannelType: "SEARCH",
				// Optional Fields:
				StartDate:                   time.Now().Format("20060102"),
				AdServingOptimizationStatus: "ROTATE",
				NetworkSetting: &NetworkSetting{
					TargetGoogleSearch:         true,
					TargetSearchNetwork:        true,
					TargetContentNetwork:       false,
					TargetPartnerSearchNetwork: false,
				},
				Settings: []CampaignSetting{
					NewGeoTargetTypeSetting(
						"DONT_CARE",
						"DONT_CARE",
					),
				},
				FrequencyCap: &FrequencyCap{
					Impressions: 5,
					TimeUnit:    "DAY",
					Level:       "ADGROUP",
				},
			},
			Campaign{
				Name:   fmt.Sprintf("Interplanetary Cruise banner #%d", time.Now().Unix()),
				Status: "PAUSED",
				BiddingStrategyConfiguration: &BiddingStrategyConfiguration{
					StrategyType: "MANUAL_CPC",
				},
				// Budget (required) - note only the budget ID is required
				BudgetId:               budgetId,
				AdvertisingChannelType: "DISPLAY",
			},
		},
	},
)
if err != nil {
	fmt.Printf("Error occured creating campaign.")
}
for _, c := range campaigns {
	fmt.Printf("Campaign with name '%s' and ID %d was added.", c.Name, c.Id)
}

// This example illustrates how to update a campaign, setting its status to 'PAUSED'
campaigns, err = cs.Mutate(
	CampaignOperations{
		"SET": {
			Campaign{
				Id:     campaigns[0].Id,
				Status: "PAUSED",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No campaigns were updated.")
} else {
	fmt.Printf("Campaign ID %d was successfully updated, status was set to '%s'.", campaigns[0].Id, campaigns[0].Status)
}

// This example removes a campaign by setting the status to 'REMOVED'.
campaigns, err = cs.Mutate(
	CampaignOperations{
		"SET": {
			Campaign{
				Id:     campaigns[0].Id,
				Status: "REMOVED",
			},
		},
	},
)
if err != nil {
	fmt.Printf("No campaigns were updated.")
} else {
	fmt.Printf("Campaign ID %d was removed.", campaigns[0].Id)
}
Output:

func (*CampaignService) MutateLabel

func (s *CampaignService) MutateLabel(campaignLabelOperations CampaignLabelOperations) (campaignLabels []CampaignLabel, err error)

Mutate allows you to add and removes labels from campaigns.

Example

cls, err := campaignService.MutateLabel(
  gads.CampaignOperations{
    "ADD": {
      gads.CampaignLabel{CampaignId: 3200, LabelId: 5353},
      gads.CampaignLabel{CampaignId: 4320, LabelId: 5643},
    },
    "REMOVE": {
      gads.CampaignLabel{CampaignId: 3653, LabelId: 5653},
    },
  }

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService#mutateLabel

func (*CampaignService) Query

func (s *CampaignService) Query(query string) (campaigns []Campaign, totalCount int64, err error)

Query documentation

https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService#query

type CampaignSetting

type CampaignSetting struct {
	XMLName xml.Name `xml:"settings"`
	Type    string   `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`

	// GeoTargetTypeSetting
	PositiveGeoTargetType *string `xml:"positiveGeoTargetType,omitempty"`
	NegativeGeoTargetType *string `xml:"negativeGeoTargetType,omitempty"`

	// RealTimeBiddingSetting
	OptIn *bool `xml:"optIn,omitempty"`

	// DynamicSearchAdsSetting
	DomainName   *string `xml:"domainName,omitempty"`
	LanguageCode *string `xml:"langaugeCode,omitempty"`

	// TrackingSetting
	TrackingUrl *string `xml:"trackingUrl,omitempty"`
}

func NewDynamicSearchAdsSetting

func NewDynamicSearchAdsSetting(domainName, languageCode string) CampaignSetting

func NewGeoTargetTypeSetting

func NewGeoTargetTypeSetting(positiveGeoTargetType, negativeGeoTargetType string) CampaignSetting

func NewRealTimeBiddingSetting

func NewRealTimeBiddingSetting(optIn bool) CampaignSetting

func NewTrackingSetting

func NewTrackingSetting(trackingUrl string) CampaignSetting

type CampaignSharedSetService

type CampaignSharedSetService struct {
	Auth
}

func NewCampaignSharedSetService

func NewCampaignSharedSetService(auth *Auth) *CampaignSharedSetService

type CarrierCriterion

type CarrierCriterion struct {
	Id          int64  `xml:"id,omitempty"`
	Name        string `xml:"name,emitempty"`
	CountryCode string `xml:"countryCode,emitempty"`
}

type CategoryProductsAndServicesSearchParameter

type CategoryProductsAndServicesSearchParameter struct {
	CategoryID int `xml:"categoryId"`
}

type CompetitionSearchParameter

type CompetitionSearchParameter struct {
	Levels []string `xml:"levels"`
}

type ConstantDataService

type ConstantDataService struct {
	Auth
}

func NewConstantDataService

func NewConstantDataService(auth *Auth) *ConstantDataService

func (*ConstantDataService) GetAgeRangeCriterion

func (s *ConstantDataService) GetAgeRangeCriterion() (ageRanges []AgeRangeCriterion, err error)

func (*ConstantDataService) GetCarrierCriterion

func (s *ConstantDataService) GetCarrierCriterion() (carriers []CarrierCriterion, err error)

func (*ConstantDataService) GetGenderCriterion

func (s *ConstantDataService) GetGenderCriterion() (genders []GenderCriterion, err error)

func (*ConstantDataService) GetLanguageCriterion

func (s *ConstantDataService) GetLanguageCriterion() (languages []LanguageCriterion, err error)

func (*ConstantDataService) GetMobileDeviceCriterion

func (s *ConstantDataService) GetMobileDeviceCriterion() (mobileDevices []MobileDeviceCriterion, err error)

func (*ConstantDataService) GetOperatingSystemVersionCriterion

func (s *ConstantDataService) GetOperatingSystemVersionCriterion() (operatingSystemVersions []OperatingSystemVersionCriterion, err error)

func (*ConstantDataService) GetProductBiddingCategoryCriterion

func (s *ConstantDataService) GetProductBiddingCategoryCriterion(selector Selector) (categoryData []ProductBiddingCategoryData, err error)

func (*ConstantDataService) GetUserInterestCriterion

func (s *ConstantDataService) GetUserInterestCriterion() (userInterests []UserInterestCriterion, err error)

func (*ConstantDataService) GetVerticalCriterion

func (s *ConstantDataService) GetVerticalCriterion() (verticals []VerticalCriterion, err error)

type ContentLabelCriterion

type ContentLabelCriterion struct {
	Id               int64  `xml:"id,omitempty"`
	ContentLabelType string `xml:"contentLabelType"` // ContentLabelType: "ADULTISH", "BELOW_THE_FOLD", "DP", "EMBEDDED_VIDEO", "GAMES", "JACKASS", "PROFANITY", "TRAGEDY", "VIDEO", "UNKNOWN"
}

type ConversionTrackerService

type ConversionTrackerService struct {
	Auth
}

func NewConversionTrackerService

func NewConversionTrackerService(auth *Auth) *ConversionTrackerService

type ConversionTrackingSettings

type ConversionTrackingSettings struct {
	EffectiveConversionTrackingId      int64 `xml:effectiveConversionTrackingId`
	UsesCrossAccountConversionTracking bool  `xml:usesCrossAccountConversionTracking`
}

type Cpc

type Cpc struct {
	Amount *CpcAmount `xml:"amount,omitempty"`
}

type CpcAmount

type CpcAmount struct {
	MicroAmount int64 `xml:"microAmount,omitempty"`
}

type Credentials

type Credentials struct {
	Config OAuthConfigArgs
	Token  OAuthTokenArgs
	Auth   Auth
}

type Criterion

type Criterion interface{}

type CriterionBidLandscape

type CriterionBidLandscape struct {
	BidLandscape
	CriterionId *int64 `xml:"criterionId,omitempty"`
}

type CriterionError

type CriterionError struct {
	EntityError
}

type CustomParameter

type CustomParameter struct {
	Key      string `xml:"key"`
	Value    string `xml:"value"`
	IsRemove bool   `xml:"isRemove"`
}

type CustomParameters

type CustomParameters struct {
	CustomParameters []CustomParameter `xml:"parameters"`
	DoReplace        bool              `xml:"doReplace"`
}

type Customer

type Customer struct {
	ID                         int64                      `xml:"customerId,omitempty"`
	CurrencyCode               string                     `xml:"currencyCode,omitempty"`
	DateTimeZone               string                     `xml:"dateTimeZone,omitempty"`
	DescriptiveName            string                     `xml:"descriptiveName,omitempty"`
	CanManageClients           bool                       `xml:"canManageClients,omitempty"`
	IsTestAccount              bool                       `xml:"testAccount,omitempty"`
	AutoTaggingEnabled         bool                       `xml:"autoTaggingEnabled,omitempty"`
	TrackingURLTemplate        string                     `xml:"trackingUrlTemplate,omitempty"`
	ConversionTrackingSettings ConversionTrackingSettings `xml:"conversionTrackingSettings"`
	RemarketingSettings        RemarketingSettings        `xml:"remarketingSettings"`
}

type CustomerFeedService

type CustomerFeedService struct {
	Auth
}

func NewCustomerFeedService

func NewCustomerFeedService(auth *Auth) *CustomerFeedService

type CustomerService

type CustomerService struct {
	Auth
}

func NewCustomerService

func NewCustomerService(auth *Auth) *CustomerService

func (*CustomerService) GetCustomers

func (s *CustomerService) GetCustomers() (customers []Customer, err error)

GetCustomers Important Notes: Starting with v201607, if clientCustomerId is specified in the request header, only details of that customer will be returned. To do this for prior versions, use the get() method instead.

type CustomerSyncService

type CustomerSyncService struct {
	Auth
}

func NewCustomerSyncService

func NewCustomerSyncService(auth *Auth) *CustomerSyncService

type DataService

type DataService struct {
	Auth
}

func NewDataService

func NewDataService(auth *Auth) *DataService

func (*DataService) GetAdGroupBidLandscape

func (s *DataService) GetAdGroupBidLandscape(selector Selector) (adGroupBidLandscapes []AdGroupBidLandscape, totalCount int64, err error)

GetAdGroupBidLandscape returns an array of AdGroupBidLandscape objects the selector.

Example

  adGroupBidLandscape, totalCount, err := dataService.GetAdGroupBidLandscape(
    gads.Selector{
      Fields: []string{
        "AdGroupId",
        "Bid",
        "CampaignId",
        "LocalClicks",
        "LocalCost",
		   "LocalImpressions",
      },
      Predicates: []gads.Predicate{
        {"AdGroupId", "EQUALS", []string{adGroupId}},
      },
    },
  )

Selectable fields are

"AdGroupId", "Bid", "CampaignId", "EndDate", "LandscapeCurrent", "LandscapeType", "LocalClicks",
"LocalCost", "LocalImpressions", "PromotedImpressions", "StartDate"

filterable fields are

"AdGroupId", "Bid", "CampaignId", "LandscapeCurrent", "LandscapeType", "LocalClicks",
"LocalCost", "LocalImpressions", "PromotedImpressions"

Relevant documentation

    https://developers.google.com/adwords/api/docs/reference/v201809/DataService#getadgroupbidlandscape
	   https://developers.google.com/adwords/api/docs/appendix/selectorfields#v201809-DataService

func (*DataService) GetCriterionBidLandscape

func (s *DataService) GetCriterionBidLandscape(selector Selector) (criterionBidLandscapes []CriterionBidLandscape, totalCount int64, err error)

GetCriterionBidLandscape returns an array of CriterionBidLandscape objects the selector.

Example

  criterionBidLandscape, totalCount, err := dataService.GetCriterionBidLandscape(
    gads.Selector{
      Fields: []string{
        "AdGroupId",
		   "CriterionId",
        "Bid",
        "CampaignId",
        "LocalClicks",
        "LocalCost",
		   "LocalImpressions",
      },
      Predicates: []gads.Predicate{
        {"CriterionId", "EQUALS", []string{criterionId}},
      },
    },
  )

Selectable fields are

"AdGroupId", "Bid", "CampaignId", "CriterionId", "EndDate", "LandscapeCurrent", "LandscapeType", "LocalClicks",
"LocalCost", "LocalImpressions", "PromotedImpressions", "StartDate"

filterable fields are

"AdGroupId", "Bid", "CampaignId", "CriterionId", "LandscapeCurrent", "LandscapeType", "LocalClicks",
"LocalCost", "LocalImpressions", "PromotedImpressions"

Relevant documentation

    https://developers.google.com/adwords/api/docs/reference/v201809/DataService#getcriterionbidlandscape
	   https://developers.google.com/adwords/api/docs/appendix/selectorfields#v201809-DataService

func (*DataService) QueryAdGroupBidLandscape

func (s *DataService) QueryAdGroupBidLandscape(query string) (adGroupBidLandscapes []AdGroupBidLandscape, totalCount int64, err error)

QueryAdGroupBidLandscape returns a slice of AdGroupBidLandscapes based on passed in AWQL query

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/DataService#queryadgroupbidlandscape

func (*DataService) QueryCriterionBidLandscape

func (s *DataService) QueryCriterionBidLandscape(query string) (criterionBidLandscapes []CriterionBidLandscape, totalCount int64, err error)

QueryCriterionBidLandscape returns a slice of CriterionBidLandscapes based on passed in AWQL query

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/DataService#querycriterionbidlandscape

type DateRange

type DateRange struct {
	Min string `xml:"min"`
	Max string `xml:"max"`
}

Selector structs

type DateRuleItem

type DateRuleItem struct {
	Key   string `xml:"key>name"`
	Op    string `xml:"op"` // "UNKNOWN", "EQUALS", "NOT_EQUAL", "BEFORE", "AFTER"
	Value string `xml:"string"`
}

Rule structs

type DayOfWeek

type DayOfWeek string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.DayOfWeek Days of the week. MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY

type Dimensions

type Dimensions struct {
	Name   string `xml:"key"` // "FULL", "SHRUNKEN", "PREVIEW", "VIDEO_THUMBNAIL"
	Width  int64  `xml:"value>width"`
	Height int64  `xml:"value>height"`
}

type DisapprovalReason

type DisapprovalReason struct {
	ShortName string `xml:"https://adwords.google.com/api/adwords/cm/v201809 shortName,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.DisapprovalReason Container for information about why an AdWords entity was disapproved.

type DoubleAttribute

type DoubleAttribute struct {
	Value float64 `xml:"value"`
}

type DraftService

type DraftService struct {
	Auth
}

func NewDraftService

func NewDraftService(auth *Auth) *DraftService

type DynamicSearchAd

type DynamicSearchAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	Url                 string                  `xml:"url"`
	DisplayUrl          string                  `xml:"displayUrl"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl                `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	DevicePreference    int64                   `xml:"devicePreference,omitempty"`
	Status              string                  `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
}

type EntityError

type EntityError struct {
	Path    string `xml:"fieldPath"`
	Trigger string `xml:"trigger"`
	String  string `xml:"errorString"`
	Reason  string `xml:"reason"`
}

type EnumValuePair

type EnumValuePair struct {
	EnumValue        string `xml:"enumValue"`
	EnumDisplayValue string `xml:"enumDisplayvalue"`
}

type ErrorsType

type ErrorsType struct {
	ApiExceptionFaults []ApiExceptionFault `xml:"ApiExceptionFault"`
}

func (ErrorsType) Error

func (f ErrorsType) Error() string

type ExpandedDynamicSearchAd

type ExpandedDynamicSearchAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	Url                 string                  `xml:"url"`
	DisplayUrl          string                  `xml:"displayUrl"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl                `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	DevicePreference    int64                   `xml:"devicePreference,omitempty"`
	Description         string                  `xml:"description"`
	Status              string                  `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.ExpandedDynamicSearchAd

type ExpandedTextAd

type ExpandedTextAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	HeadlinePart1       string                  `xml:"headlinePart1"`
	HeadlinePart2       string                  `xml:"headlinePart2"`
	Description         string                  `xml:"description"`
	Path1               string                  `xml:"path1"`
	Path2               string                  `xml:"path2"`
	ExperimentData      *AdGroupExperimentData  `xml:"-"`
	Status              string                  `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
	Labels              []Label                 `xml:"-"`
	BaseCampaignId      *int64                  `xml:"-"`
	BaseAdGroupId       *int64                  `xml:"-"`
}

type ExperimentService

type ExperimentService struct {
	Auth
}

func NewExperimentService

func NewExperimentService(auth *Auth) *ExperimentService

type Extension

type Extension interface{}

type ExtensionFeedItem

type ExtensionFeedItem struct {
	XMLName xml.Name `json:"-" xml:"extensions"`

	FeedId                  int64                      `xml:"https://adwords.google.com/api/adwords/cm/v201809 feedId,omitempty"`
	FeedItemId              int64                      `xml:"https://adwords.google.com/api/adwords/cm/v201809 feedItemId,omitempty"`
	Status                  *FeedItemStatus            `xml:"https://adwords.google.com/api/adwords/cm/v201809 status,omitempty"`
	FeedType                *FeedType                  `xml:"https://adwords.google.com/api/adwords/cm/v201809 feedType,omitempty"`
	StartTime               string                     `xml:"https://adwords.google.com/api/adwords/cm/v201809 startTime,omitempty"` //  special value "00000101 000000" may be used to clear an existing start time.
	EndTime                 string                     `xml:"https://adwords.google.com/api/adwords/cm/v201809 endTime,omitempty"`   //  special value "00000101 000000" may be used to clear an existing end time.
	DevicePreference        *FeedItemDevicePreference  `xml:"https://adwords.google.com/api/adwords/cm/v201809 devicePreference,omitempty"`
	Scheduling              *FeedItemScheduling        `xml:"https://adwords.google.com/api/adwords/cm/v201809 scheduling,omitempty"`
	CampaignTargeting       *FeedItemCampaignTargeting `xml:"https://adwords.google.com/api/adwords/cm/v201809 campaignTargeting,omitempty"`
	AdGroupTargeting        *FeedItemAdGroupTargeting  `xml:"https://adwords.google.com/api/adwords/cm/v201809 adGroupTargeting,omitempty"`
	KeywordTargeting        *Keyword                   `xml:"https://adwords.google.com/api/adwords/cm/v201809 keywordTargeting,omitempty"`
	GeoTargeting            *Location                  `xml:"https://adwords.google.com/api/adwords/cm/v201809 geoTargeting,omitempty"`
	GeoTargetingRestriction *FeedItemGeoRestriction    `xml:"https://adwords.google.com/api/adwords/cm/v201809 geoTargetingRestriction,omitempty"`

	ExtensionFeedItemType string `xml:"https://adwords.google.com/api/adwords/cm/v201809 ExtensionFeedItem.Type,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.ExtensionFeedItem Contains base extension feed item data for an extension in an extension feed managed by AdWords.

type ExtensionSetting

type ExtensionSetting struct {
	PlatformRestrictions ExtensionSettingPlatform `xml:"platformRestrictions,omitempty"`

	Extensions Extension `xml:"https://adwords.google.com/api/adwords/cm/v201809 extensions,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.ExtensionSetting A setting specifying when and which extensions should serve at a given level (customer, campaign, or ad group).

func (ExtensionSetting) MarshalXML

func (s ExtensionSetting) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*ExtensionSetting) UnmarshalXML

func (s *ExtensionSetting) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) (err error)

type ExtensionSettingPlatform

type ExtensionSettingPlatform string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.ExtensionSetting.Platform Different levels of platform restrictions DESKTOP, MOBILE, NONE

type Fault

type Fault struct {
	XMLName     xml.Name   `xml:"Fault"`
	FaultCode   string     `xml:"faultcode"`
	FaultString string     `xml:"faultstring"`
	Errors      ErrorsType `xml:"detail"`
}

func (Fault) Error

func (f Fault) Error() string

type Feed

type Feed struct {
	Id                       int64                      `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Name                     string                     `xml:"https://adwords.google.com/api/adwords/cm/v201809 name,omitempty"`
	Attributes               []FeedAttribute            `xml:"https://adwords.google.com/api/adwords/cm/v201809 attributes,omitempty"`
	Status                   FeedStatus                 `xml:"https://adwords.google.com/api/adwords/cm/v201809 status,omitempty"`
	Origin                   FeedOrigin                 `xml:"https://adwords.google.com/api/adwords/cm/v201809 origin,omitempty"`
	SystemFeedGenerationData []SystemFeedGenerationData `xml:"https://adwords.google.com/api/adwords/cm/v201809 systemFeedGenerationData,omitempty"`
}

A Feed identifies a source of data and its schema. The data for the Feed can either be user-entered via the FeedItemService or system-generated, in which case the data is provided automatically. https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.Feed

type FeedAttribute

type FeedAttribute struct {
	Id          int64             `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Name        string            `xml:"https://adwords.google.com/api/adwords/cm/v201809 name,omitempty"`
	Type        FeedAttributeType `xml:"https://adwords.google.com/api/adwords/cm/v201809 type,omitempty"`
	IsPartOfKey bool              `xml:"https://adwords.google.com/api/adwords/cm/v201809 isPartOfKey,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.FeedAttribute FeedAttributes define the types of data expected to be present in a Feed. A single FeedAttribute specifies the expected type of the FeedItemAttributes with the same FeedAttributeId. Optionally, a FeedAttribute can be marked as being part of a FeedItem's unique key.

type FeedItemAdGroupTargeting

type FeedItemAdGroupTargeting struct {
	TargetingAdGroupId int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 TargetingAdGroupId,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemAdGroupTargeting Specifies the adgroup the request context must match in order for the feed item to be considered eligible for serving (aka the targeted adgroup). E.g., if the below adgroup targeting is set to adgroup = X, then the feed item can only serve under adgroup X.

type FeedItemAttributeError

type FeedItemAttributeError struct {
	FeedAttributeIds    []int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 feedAttributeIds,omitempty"`
	ValidationErrorCode int     `xml:"https://adwords.google.com/api/adwords/cm/v201809 validationErrorCode,omitempty"`
	ErrorInformation    string  `xml:"https://adwords.google.com/api/adwords/cm/v201809 errorInformation,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemAttributeError Contains validation error details for a set of feed attributes

type FeedItemCampaignTargeting

type FeedItemCampaignTargeting struct {
	TargetingCampaignId int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 TargetingCampaignId,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemCampaignTargeting Specifies the campaign the request context must match in order for the feed item to be considered eligible for serving (aka the targeted campaign). E.g., if the below campaign targeting is set to campaignId = X, then the feed item can only serve under campaign X.

type FeedItemDevicePreference

type FeedItemDevicePreference struct {
	DevicePreference int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 devicePreference,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemDevicePreference Represents a FeedItem device preference

type FeedItemGeoRestriction

type FeedItemGeoRestriction struct {
	GeoRestriction GeoRestriction `xml:"https://adwords.google.com/api/adwords/cm/v201809 geoRestriction,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemGeoRestriction Represents a FeedItem geo restriction.

type FeedItemQualityApprovalStatus

type FeedItemQualityApprovalStatus string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemQualityApprovalStatus Feed item quality evaluation approval status UNCHECKED, APPROVED, DISAPPROVED

type FeedItemSchedule

type FeedItemSchedule struct {
	DayOfWeek   DayOfWeek    `xml:"https://adwords.google.com/api/adwords/cm/v201809 dayOfWeek,omitempty"`
	StartHour   int          `xml:"https://adwords.google.com/api/adwords/cm/v201809 startHour,omitempty"`
	StartMinute MinuteOfHour `xml:"https://adwords.google.com/api/adwords/cm/v201809 startMinute,omitempty"`
	EndHour     int          `xml:"https://adwords.google.com/api/adwords/cm/v201809 endHour,omitempty"`
	EndMinute   MinuteOfHour `xml:"https://adwords.google.com/api/adwords/cm/v201809 endMinute,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemSchedule Represents a FeedItem schedule, which specifies a time interval on a given day when the feed item may serve. The FeedItemSchedule times are in the account's time zone.

type FeedItemScheduling

type FeedItemScheduling struct {
	// contains filtered or unexported fields
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.FeedItemScheduling Represents a collection of FeedItem schedules specifying all time intervals for which the feed item may serve. Any time range not covered by the specified FeedItemSchedules will prevent the feed item from serving during those times.

type FeedItemService

type FeedItemService struct {
	Auth
}

func NewFeedItemService

func NewFeedItemService(auth *Auth) *FeedItemService

type FeedMappingService

type FeedMappingService struct {
	Auth
}

func NewFeedMappingService

func NewFeedMappingService(auth *Auth) *FeedMappingService

type FeedOrigin

type FeedOrigin string

Used to Specify who manages the FeedAttributes for the Feed. https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.Feed.Origin USER, ADWORDS, UNKNOWN

type FeedService

type FeedService struct {
	Auth
}

func NewFeedService

func NewFeedService(auth *Auth) *FeedService

func (*FeedService) Query

func (s *FeedService) Query(query string) (page []Feed, totalCount int64, err error)

https://developers.google.com/adwords/api/docs/reference/v201809/FeedService

type FeedStatus

type FeedStatus string

https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.Feed.Status Status of the Feed. ENABLED, REMOVED, UNKNOWN

type FeedType

type FeedType string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.Feed.Type Feed hard type. Values coincide with placeholder type id. Enum: NONE, SITELINK, CALL, APP, REVIEW, AD_CUSTOMIZER, CALLOUT, STRUCTURED_SNIPPET, PRICE

type FrequencyCap

type FrequencyCap struct {
	Impressions int64  `xml:"impressions"`
	TimeUnit    string `xml:"timeUnit"`
	Level       string `xml:"level,omitempty"`
}

type GenderCriterion

type GenderCriterion struct {
	Id         int64  `xml:"id,omitempty"`
	GenderType string `xml:"genderType"` // GenderType:  "GENDER_MALE", "GENDER_FEMALE", "GENDER_UNDETERMINED"
}

type GeoLocationService

type GeoLocationService struct {
	Auth
}

func NewGeoLocationService

func NewGeoLocationService(auth *Auth) *GeoLocationService

type GeoPoint

type GeoPoint struct {
	Latitude  int64 `xml:"latitudeInMicroDegrees"`
	Longitude int64 `xml:"longitudeInMicroDegrees"`
}

type GeoRestriction

type GeoRestriction string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.GeoRestriction A restriction used to determine if the request context's geo should be matched. UNKNOWN, LOCATION_OF_PRESENCE

type IdeaTextFilterSearchParameter

type IdeaTextFilterSearchParameter struct {
	Included []string `xml:"included"`
	Excluded []string `xml:"excluded"`
}

type IdeaTypeAttribute

type IdeaTypeAttribute struct {
	Value string `xml:"value"`
}

type ImageAd

type ImageAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	Url                 string                  `xml:"url"`
	DisplayUrl          string                  `xml:"displayUrl"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl                `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	DevicePreference    int64                   `xml:"devicePreference,omitempty"`
	Image               int64                   `xml:"imageId"`
	Name                string                  `xml:"name"`
	AdToCopyImageFrom   int64                   `xml:"adToCopyImageFrom"`
	Status              string                  `xml:"-"`
	Labels              []Label                 `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
}

type ImageUrl

type ImageUrl struct {
}

type IncludeAdultContentSearchParameter

type IncludeAdultContentSearchParameter struct{}

type IntegerSetAttribute

type IntegerSetAttribute struct {
	Value []int `xml:"value"`
}

type Keyword

type Keyword struct {
	Id            int64         `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Type          CriterionType `xml:"https://adwords.google.com/api/adwords/cm/v201809 type,omitempty"`
	CriterionType CriterionType `xml:"https://adwords.google.com/api/adwords/cm/v201809 Criterion.Type,omitempty"`

	Text      string           `xml:"https://adwords.google.com/api/adwords/cm/v201809 text,omitempty"`
	MatchType KeywordMatchType `xml:"https://adwords.google.com/api/adwords/cm/v201809 matchType,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.Keyword Represents a keyword.

type KeywordCriterion

type KeywordCriterion struct {
	Id        int64  `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Text      string `xml:"https://adwords.google.com/api/adwords/cm/v201809 text,omitempty"`      // Text: up to 80 characters and ten words
	MatchType string `xml:"https://adwords.google.com/api/adwords/cm/v201809 matchType,omitempty"` // MatchType:  "EXACT", "PHRASE", "BROAD"
}

type KeywordEstimate

type KeywordEstimate struct {
	Min StatsEstimate `xml:"min"`
	Max StatsEstimate `xml:"max"`
}

type KeywordEstimateRequest

type KeywordEstimateRequest struct {
	Keyword KeywordCriterion `xml:"keyword"`
}

type KeywordMatchType

type KeywordMatchType string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.KeywordMatchType Match type of a keyword. i.e. the way we match a keyword string with search queries. EXACT, PHRASE, BROAD

type Label

type Label struct {
	Type   string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
	Id     int64  `xml:"id,omitempty"`
	Name   string `xml:"name,omitempty"`
	Status string `xml:"status,omitempty"`
}

Label represents a label.

func NewTextLabel

func NewTextLabel(name string) Label

NewTextLabel returns an new Label struct for creating a new TextLabel.

type LabelError

type LabelError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type LabelOperations

type LabelOperations map[string][]Label

LabelOperations is a map of operations to perform on Label's

type LabelService

type LabelService struct {
	Auth
}

func NewLabelService

func NewLabelService(auth *Auth) *LabelService

func (LabelService) Get

func (s LabelService) Get(selector Selector) (labels []Label, totalCount int64, err error)

Get returns an array of Label's and the total number of Label's matching the selector.

Example

labels, totalCount, err := labelService.Get(
  Selector{
    Fields: []string{"LabelId","LabelName","LabelStatus"},
    Predicates: []Predicate{
      {"LabelStatus", "EQUALS", []string{"ENABLED"}},
    },
  },
)

Selectable fields are

"LabelId", "LabelName", "LabelStatus"

filterable fields are

"LabelId", "LabelName", "LabelStatus"

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/LabelService#get

func (*LabelService) Mutate

func (s *LabelService) Mutate(labelOperations LabelOperations) (labels []Label, err error)

Mutate allows you to add, modify and remove labels, returning the modified labels.

Example

labels, err := labelService.Mutate(
  LabelOperations{
    "ADD": {
      NewTextLabel("Label1"),
      NewTextLabel("Label2"),
    },
    "SET": {
      modifiedLabel,
    },
    "REMOVE": {
      Label{Type:"TextLabel",Id:10},
    },
  },
)

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/LabelService#mutate

func (*LabelService) Query

func (s *LabelService) Query(query string) (labels []Label, totalCount int64, err error)

Query documentation

https://developers.google.com/adwords/api/docs/reference/v201506/LabelService#query

type LandscapePoint

type LandscapePoint struct {
	Bid                 *int64 `xml:"bid>microAmount,omitempty"`
	Clicks              *int64 `xml:"clicks,omitempty"`
	Cost                *int64 `xml:"cost>microAmount,omitempty"`
	Impressions         *int64 `xml:"impressions,omitempty"`
	PromotedImpressions *int64 `xml:"promotedImpressions,omitempty"`
}

type LanguageCriterion

type LanguageCriterion struct {
	Id   int64  `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Code string `xml:"https://adwords.google.com/api/adwords/cm/v201809 code,omitempty"`
	Name string `xml:"https://adwords.google.com/api/adwords/cm/v201809 name,omitempty"`
}

type LanguageSearchParameter

type LanguageSearchParameter struct {
	Languages []LanguageCriterion `xml:"languages"`
}

type Location

type Location struct {
	Id            int64         `xml:"https://adwords.google.com/api/adwords/cm/v201809 id,omitempty"`
	Type          CriterionType `xml:"https://adwords.google.com/api/adwords/cm/v201809 type,omitempty"`
	CriterionType CriterionType `xml:"https://adwords.google.com/api/adwords/cm/v201809 Criterion.Type,omitempty"`

	LocationName    string                  `xml:"https://adwords.google.com/api/adwords/cm/v201809 locationName,omitempty"`
	DisplayType     string                  `xml:"https://adwords.google.com/api/adwords/cm/v201809 displayType,omitempty"`
	TargetingStatus LocationTargetingStatus `xml:"https://adwords.google.com/api/adwords/cm/v201809 targetingStatus,omitempty"`
	ParentLocations []Location              `xml:"https://adwords.google.com/api/adwords/cm/v201809 parentLocations,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.Location Represents Location criterion. A criterion of this type can only be created using an ID. LocationName: DisplayType: TargetingStatus: ACTIVE, OBSOLETE, PHASING_OUT ParentLocations:

type LocationCriterion

type LocationCriterion struct {
	Location      Location `xml:"location"`
	CanonicalName string   `xml:"canonicalName,omitempty"`
	Reach         string   `xml:"reach,omitempty"`
	Locale        string   `xml:"locale,omitempty"`
	SearchTerm    string   `xml:"searchTerm"`
}

type LocationCriterionService

type LocationCriterionService struct {
	Auth
}

func NewLocationCriterionService

func NewLocationCriterionService(auth *Auth) *LocationCriterionService

func (*LocationCriterionService) Get

func (s *LocationCriterionService) Get(selector Selector) (locationCriterions LocationCriterions, err error)

type LocationCriterions

type LocationCriterions []LocationCriterion

type LocationSearchParameter

type LocationSearchParameter struct {
	Locations []Location `xml:"locations"`
}

type LocationTargetingStatus

type LocationTargetingStatus string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.LocationTargetingStatus Enum that represents the different Targeting Status values for a Location criterion. ACTIVE, OBSOLETE, PHASING_OUT

type LongAttribute

type LongAttribute struct {
	Value int64 `xml:"value"`
}

type ManagedCustomer

type ManagedCustomer struct {
	ID                    int64          `xml:"customerId,omitempty"`
	Name                  string         `xml:"name"`
	CanManageClients      bool           `xml:"canManageClients,omitempty"`
	CurrencyCode          string         `xml:"currencyCode"`
	DateTimeZone          string         `xml:"dateTimeZone"`
	IsTestAccount         bool           `xml:"testAccount,omitempty"`
	AccountLabels         []AccountLabel `xml:"accountLabels,omitempty"`
	ExcludeHiddenAccounts bool           `xml:"excludeHiddenAccounts,omitempty"`
}
type ManagedCustomerLink struct {
	ManagerCustomerId      int64  `xml:"managerCustomerId"`
	ClientCustomerId       int64  `xml:"clientCustomerId"`
	LinkStatus             string `xml:"linkStatus"`
	PendingDescriptiveName string `xml:"pendingDescriptiveName"`
	IsHidden               bool   `xml:isHidden"`
}

type ManagedCustomerOperations

type ManagedCustomerOperations map[string][]ManagedCustomer

type ManagedCustomerPage

type ManagedCustomerPage struct {
	Size                 int64                 `xml:"rval>totalNumEntries"`
	ManagedCustomers     []ManagedCustomer     `xml:"rval>entries"`
	ManagedCustomerLinks []ManagedCustomerLink `xml:"rval>links"`
}

type ManagedCustomerService

type ManagedCustomerService struct {
	Auth
	CustomerID string
}

func NewManagedCustomerService

func NewManagedCustomerService(auth *Auth, customerID string) *ManagedCustomerService

func (*ManagedCustomerService) Get

func (s *ManagedCustomerService) Get(selector Selector) (managedCustomerPage ManagedCustomerPage, totalCount int64, err error)

func (*ManagedCustomerService) Mutate

func (s *ManagedCustomerService) Mutate(managedCustomerOperations ManagedCustomerOperations) (managedCustomers []ManagedCustomer, err error)

type Media

type Media struct {
	Type           string       `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
	Id             int64        `xml:"mediaId,omitempty"`
	MediaType      string       `xml:"type"` // "AUDIO", "DYNAMIC_IMAGE", "ICON", "IMAGE", "STANDARD_ICON", "VIDEO"
	ReferenceId    int64        `xml:"referenceId,omitempty"`
	Dimensions     []Dimensions `xml:"dimensions"`
	Urls           []ImageUrl   `xml:"urls"`
	LegacyMimeType string       `xml:"legacyMimeType,omitempty"` // "IMAGE_JPEG", "IMAGE_GIF", "IMAGE_PNG", "FLASH", "TEXT_HTML", "PDF", "MSWORD", "MSEXCEL", "RTF", "AUDIO_WAV", "AUDIO_MP3"
	SourceUrl      string       `xml:"sourceUrl,omitempty"`
	Name           string       `xml:"name"`
	FileSize       int64        `xml:"fileSize,omitempty"`   // File size in bytes
	CreationTime   string       `xml:"createTime,omitempty"` // format is YYYY-MM-DD HH:MM:SS+TZ

	// Audio / Video
	DurationMillis   int64  `xml:"durationMillis,omitempty"`
	StreamingUrl     string `xml:"streamingUrl,omitempty"`
	ReadyToPlayOnWeb bool   `xml:"readyToPlayOnTheWeb,omitempty"`

	// Image
	Data string `xml:"data,omitempty"` // base64Binary encoded raw image data

	// Video
	IndustryStandardCommercialIdentifier string `xml:"industryStandardCommercialIdentifier,omitempty"`
	AdvertisingId                        string `xml:"advertisingId,omitempty"`
	YouTubeVideoIdString                 string `xml:"youTubeVideoIdString,omitempty"`
}

Media represents an audio, image or video file.

func NewAudio

func NewAudio(name, mediaType, mimeType string) (image Media)

func NewImage

func NewImage(name, mediaType, mimeType string, data []byte) (image Media)

func NewVideo

func NewVideo(mediaType string) (image Media)

type MediaService

type MediaService struct {
	Auth
}

func NewMediaService

func NewMediaService(auth *Auth) *MediaService

func (*MediaService) Get

func (s *MediaService) Get(selector Selector) (medias []Media, totalCount int64, err error)

func (*MediaService) Query

func (s *MediaService) Query(query string) (medias []Media, totalCount int64, err error)

func (*MediaService) Upload

func (s *MediaService) Upload(medias []Media) (uploadedMedias []Media, err error)
Example
// load image into []byte
imageUrl := "http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg"
resp, err := http.Get(imageUrl)
if err != nil {
	panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)

// load credentials from
authConf, _ := NewCredentials(context.TODO())
ms := NewMediaService(&authConf.Auth)

images, err := ms.Upload([]Media{NewImage("image1", "IMAGE", "IMAGE_JPEG", body)})
if err != nil {
	panic(err)
}
fmt.Printf("%#v", images)
Output:

type Member

type Member struct {
	Emails      []string     `xml:"hashedEmail,omitempty"`
	MobileIDs   []string     `xml:"mobileId,omitempty"`
	AddressInfo *AddressInfo `xml:"addressInfo,omitempty"`
}

Member holds user list member identifiers. https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService.Member

type MinuteOfHour

type MinuteOfHour string

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.MinuteOfHour Minutes in an hour. Currently only 0, 15, 30, and 45 are supported ZERO, FIFTEEN, THIRTY, FORTY_FIVE

type MobileAd

type MobileAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	Url                 string                  `xml:"url"`
	DisplayUrl          string                  `xml:"displayUrl"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl                `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	DevicePreference    int64                   `xml:"devicePreference,omitempty"`
	Headline            string                  `xml:"headline"`
	Description         string                  `xml:"description"`
	MarkupLanguages     []string                `xml:"markupLanguages"`
	MobileCarriers      []string                `xml:"mobileCarriers"`
	BusinessName        string                  `xml:"businessName"`
	CountryCode         string                  `xml:"countryCode"`
	PhoneNumber         string                  `xml:"phoneNumber"`
	Status              string                  `xml:"-"`
	Labels              []Label                 `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
}

type MobileAppCategoryCriterion

type MobileAppCategoryCriterion struct {
	Id                  int64  `xml:"id,omitempty"`
	MobileAppCategoryId int64  `xml:"mobileAppCategoryId"`
	DisplayName         string `xml:"displayName,omitempty"`
}

MobileAppCategoryId:

https://developers.google.com/adwords/api/docs/appendix/mobileappcategories

DisplayName:

type MobileApplicationCriterion

type MobileApplicationCriterion struct {
	Id          int64  `xml:"id,omitempty"`
	AppId       string `xml:"appId"`
	DisplayName string `xml:"displayName,omitempty"`
}

AppId: "{platform}-{platform_native_id}" DisplayName:

type MobileDeviceCriterion

type MobileDeviceCriterion struct {
	Id                  int64  `xml:"id,omitempty"`
	DeviceName          string `xml:"deviceName,omitempty"`
	ManufacturerName    string `xml:"manufacturerName,omitempty"`
	DeviceType          string `xml:"deviceType,omitempty"`
	OperatingSystemName string `xml:"operatingSystemName,omitempty"`
}

DeviceName: ManufacturerName: DeviceType: DEVICE_TYPE_MOBILE, DEVICE_TYPE_TABLET OperatingSystemName:

type MoneyAttribute

type MoneyAttribute struct {
	Value int64 `xml:"value>microAmount"`
}

type MonthlySearchVolume

type MonthlySearchVolume struct {
	Year  int   `xml:"year"`
	Month int   `xml:"month"`
	Count int64 `xml:"count"`
}

type MonthlySearchVolumeAttribute

type MonthlySearchVolumeAttribute struct {
	Value []MonthlySearchVolume `xml:"value"`
}

type MutateErrors

type MutateErrors struct {
	Errors EntityError `xml:"errors"`
}

type MutateJobService

type MutateJobService struct {
	Auth
}

func NewMutateJobService

func NewMutateJobService(auth *Auth) *MutateJobService

type MutateMembersOperand

type MutateMembersOperand struct {
	UserListId int64    `xml:"userListId"`
	RemoveAll  *bool    `xml:"removeAll"`
	Members    []Member `xml:"membersList"`
}

func NewMutateMembersOperand

func NewMutateMembersOperand() *MutateMembersOperand

func (MutateMembersOperand) MarshalXML

func (mmo MutateMembersOperand) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML is custom XML marshalling logc for the MutateMembersOperand object

type MutateMembersOperations

type MutateMembersOperations struct {
	XMLName    xml.Name
	Operations []Operation `xml:"operations"`
}

type MutateResult

type MutateResult interface{}

type MutateResults

type MutateResults struct {
	Result    MutateResult   `xml:"result"`
	ErrorList []MutateErrors `xml:"errorList"`
	Index     int            `xml:"index"`
}

func (*MutateResults) UnmarshalXML

func (mr *MutateResults) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) (err error)

type NegativeAdGroupCriterion

type NegativeAdGroupCriterion struct {
	AdGroupId    int64     `xml:"adGroupId"`
	CriterionUse string    `xml:"criterionUse"`
	Criterion    Criterion `xml:"criterion"`
}

func (NegativeAdGroupCriterion) MarshalXML

func (nagc NegativeAdGroupCriterion) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*NegativeAdGroupCriterion) UnmarshalXML

func (nagc *NegativeAdGroupCriterion) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type NegativeCampaignCriterion

type NegativeCampaignCriterion struct {
	CampaignId  int64     `xml:"campaignId"`
	IsNegative  bool      `xml:"isNegative,omitempty"`
	Criterion   Criterion `xml:"criterion"`
	BidModifier *float64  `xml:"bidModifier,omitempty"`
	Errors      []error   `xml:"-"`
}

func (NegativeCampaignCriterion) MarshalXML

func (ncc NegativeCampaignCriterion) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type NetworkSearchParameter

type NetworkSearchParameter struct {
	NetworkSetting NetworkSetting `xml:"networkSetting"`
}

type NetworkSetting

type NetworkSetting struct {
	TargetGoogleSearch         bool `xml:"https://adwords.google.com/api/adwords/cm/v201809 targetGoogleSearch"`
	TargetSearchNetwork        bool `xml:"https://adwords.google.com/api/adwords/cm/v201809 targetSearchNetwork"`
	TargetContentNetwork       bool `xml:"https://adwords.google.com/api/adwords/cm/v201809 targetContentNetwork"`
	TargetPartnerSearchNetwork bool `xml:"https://adwords.google.com/api/adwords/cm/v201809 targetPartnerSearchNetwork"`
}

type NotEmptyError

type NotEmptyError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type NumberRuleItem

type NumberRuleItem struct {
	Key   string `xml:"key>name"`
	Op    string `xml:"op"` // "UNKNOWN", "GREATER_THAN", "GREATER_THAN_OR_EQUAL", "EQUALS", "NOT_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL"
	Value int64  `xml:"value"`
}

type OAuthConfigArgs

type OAuthConfigArgs struct {
	ClientID     string
	ClientSecret string
}

type OAuthTokenArgs

type OAuthTokenArgs struct {
	AccessToken  string
	RefreshToken string
}

type OfflineConversionService

type OfflineConversionService struct {
	Auth
}

func NewOfflineConversionService

func NewOfflineConversionService(auth *Auth) *OfflineConversionService

type OperatingSystemVersionCriterion

type OperatingSystemVersionCriterion struct {
	Id             int64  `xml:"id,omitempty"`
	Name           string `xml:"name,omitempty"`
	OsMajorVersion int64  `xml:"osMajorVersion,omitempty"`
	OsMinorVersion int64  `xml:"osMinorVersion,omitempty"`
	OperatorType   string `xml:"operatorType,omitempty"`
}

Name: OsMajorVersion: OsMinorVersion: OperatorType: GREATER_THAN_EQUAL_TO, EQUAL_TO, UNKNOWN

type Operation

type Operation struct {
	Operator string      `xml:"https://adwords.google.com/api/adwords/cm/v201809 operator"`
	Operand  interface{} `xml:"operand"`
	Xsi_type string      `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr,omitempty"`
}

type OperationError

type OperationError struct {
	Code      int64  `xml:"OperationError>Code"`
	Details   string `xml:"OperationError>Details"`
	ErrorCode string `xml:"OperationError>ErrorCode"`
	Message   string `xml:"OperationError>Message"`
}

type Options

type Options struct {
	CustomerID string
}

type OrderBy

type OrderBy struct {
	Field     string `xml:"field"`
	SortOrder string `xml:"sortOrder"`
}

type Page

type Page struct {
	TotalNumEntries int    `xml:"https://adwords.google.com/api/adwords/cm/v201809 totalNumEntries,omitempty"`
	PageType        string `xml:"https://adwords.google.com/api/adwords/cm/v201809 Page.Type,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.Page Contains the results from a get call.

type Paging

type Paging struct {
	Offset int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 startIndex"`
	Limit  int64 `xml:"https://adwords.google.com/api/adwords/cm/v201809 numberResults"`
}

type PlacementCriterion

type PlacementCriterion struct {
	Id  int64  `xml:"id,omitempty"`
	Url string `xml:"url"`
}

Url:

type PlatformCriterion

type PlatformCriterion struct {
	Id           int64  `xml:"id,omitempty"`
	PlatformName string `xml:"platformName,omitempty"`
}

PlatformId:

Desktop	30000
HighEndMobile	30001
Tablet	30002

type PolicyData

type PolicyData struct {
	DisapprovalReasons []DisapprovalReason `xml:"https://adwords.google.com/api/adwords/cm/v201809 disapprovalReasons,omitempty"`
	PolicyDataType     string              `xml:"https://adwords.google.com/api/adwords/cm/v201809 PolicyData.Type,omitempty"`
}

https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupExtensionSettingService.PolicyData Approval and policy information attached to an entity.

type PolicyTopicConstraint

type PolicyTopicConstraint struct {
	ConstraintType string `xml:"constraintType,omitempty"`
	Type           string `xml:"PolicyTopicConstraint.Type,omitempty"`
}

type PolicyTopicEntry

type PolicyTopicEntry struct {
	Type         string                  `xml:"policyTopicEntryType,omitempty"`
	Evidences    []PolicyTopicEvidence   `xml:"policyTopicEvidences,omitempty"`
	PConstraints []PolicyTopicConstraint `xml:"policyTopicConstraints,omitempty"`
	ID           string                  `xml:"policyTopicId,omitempty"`
	Name         string                  `xml:"policyTopicName,omitempty"`
}

type PolicyTopicEvidence

type PolicyTopicEvidence struct {
	Type string   `xml:"policyTopicEvidenceType,omitempty"`
	Text []string `xml:"evidenceTextList,omitempty"`
}

type Predicate

type Predicate struct {
	Field    string   `xml:"field"`
	Operator string   `xml:"operator"`
	Values   []string `xml:"values"`
}

type ProductAd

type ProductAd struct {
	AdGroupId     int64                   `xml:"-"`
	Id            int64                   `xml:"id,omitempty"`
	Type          string                  `xml:"type,omitempty"`
	Status        string                  `xml:"-"`
	PolicySummary *AdGroupAdPolicySummary `xml:"-"`
}

type ProductBiddingCategory

type ProductBiddingCategory ProductDimension

Represents a google_product_category level

type ProductBiddingCategoryData

type ProductBiddingCategoryData struct {
	DimensionValue       ProductBiddingCategory `xml:"dimensionValue"`
	ParentDimensionValue ProductBiddingCategory `xml:"parentDimensionValue"`
	Country              string                 `xml:"country"`
	Status               string                 `xml:"status"`
	DisplayValue         []StringMapEntry       `xml:"displayValue"`
}

type ProductCondition

type ProductCondition struct {
	Argument string `xml:"argument"`
	Operand  string `xml:"operand"`
}

Argument: Operand: id, product_type, brand, adwords_grouping, condition, adwords_labels

type ProductCriterion

type ProductCriterion struct {
	Id         int64              `xml:"id,omitempty"`
	Conditions []ProductCondition `xml:"conditions"`
	Text       string             `xml:"text,omitempty"`
}

type ProductDimension

type ProductDimension struct {
	Type          string `xml:"ProductDimension.Type"`
	DimensionType string `xml:"type"`
	Value         string `xml:"value"`
}

type ProductPartition

type ProductPartition struct {
	Id                int64            `xml:"id,omitempty"`
	CriteriaType      string           `xml:"type"`
	PartitionType     string           `xml:"partitionType,omitempty"`
	ParentCriterionId int64            `xml:"parentCriterionId,omitempty"`
	Dimension         ProductDimension `xml:"caseValue"`
	Cpc               *Cpc             // This value is inherited from BiddableAdgroupCriterion
}

type ProductScope

type ProductScope struct {
	Id           int64              `xml:"id,omitempty"`
	CriteriaType string             `xml:"type"`
	Dimensions   []ProductDimension `xml:"dimensions"`
}

type ProgressStats

type ProgressStats struct {
	NumOperationsExecuted    int64 `xml:"numOperationsExecuted" json:",string"`
	NumOperationsSucceeded   int64 `xml:"numOperationsSucceeded" json:",string"`
	EstimatedPercentExecuted int   `xml:"estimatedPercentExecuted"`
	NumResultsWritten        int64 `xml:"numResultsWritten" json:",string"`
}

type ProximityCriterion

type ProximityCriterion struct {
	Id                  int64    `xml:"id,omitempty"`
	GeoPoint            GeoPoint `xml:"geoPoint"`
	RadiusDistanceUnits string   `xml:"radiusDistanceUnits"`
	RadiusInUnits       float64  `xml:"radiusInUnits"`
	Address             Address  `xml:"address"`
}

RadiusDistanceUnits: KILOMETERS, MILES RadiusUnits:

type QualityInfo

type QualityInfo struct {
	IsKeywordAdRelevanceAcceptable bool  `xml:"isKeywordAdRelevanceAcceptable,omitempty"`
	IsLandingPageQualityAcceptable bool  `xml:"isLandingPageQualityAcceptable,omitempty"`
	IsLandingPageLatencyAcceptable bool  `xml:"isLandingPageLatencyAcceptable,omitempty"`
	QualityScore                   int64 `xml:"qualityScore,omitempty"`
}

type RateExceededError

type RateExceededError struct {
	RateName          string `xml:"rateName"`  // For example OperationsByMinute
	RateScope         string `xml:"rateScope"` // ACCOUNT or DEVELOPER
	ErrorString       string `xml:"errorString"`
	Reason            string `xml:"reason"`
	RetryAfterSeconds uint   `xml:"retryAfterSeconds"` // Try again in...
}

if you exceed the quota given by google

type RelatedToQuerySearchParameter

type RelatedToQuerySearchParameter struct {
	Queries []string `xml:"queries"`
}

type RelatedToUrlSearchParameter

type RelatedToUrlSearchParameter struct {
	Urls           []string `xml:"urls"`
	IncludeSubUrls bool     `xml:"includeSubUrls"`
}

type RemarketingSettings

type RemarketingSettings struct {
	Snippet string `xml:"snippet"`
}

type ReportDefinition

type ReportDefinition struct {
	Selector       Selector `xml:"selector"`
	ReportName     string   `xml:"reportName"`
	ReportType     string   `xml:"reportType"`
	DateRangeType  string   `xml:"dateRangeType"`
	DownloadFormat string   `xml:"downloadFormat"`
}

type ReportDefinitionField

type ReportDefinitionField struct {
	FieldName           string          `xml:"fieldName"`
	DisplayFieldName    string          `xml:"displayFieldName"`
	XmlAttributeName    string          `xml:"xmlAttributeName"`
	FieldType           string          `xml:"fieldType"`
	FieldBehavior       string          `xml:"fieldBehavior"`
	EnumValues          []string        `xml:"enumValues"`
	CanSelect           bool            `xml:"canSelect"`
	CanFilter           bool            `xml:"canFilter"`
	IsEnumType          bool            `xml:"isEnumType"`
	IsBeta              bool            `xml:"isBeta"`
	IsZeroRowCompatible bool            `xml:"isZeroRowCompatible"`
	EnumValuePairs      []EnumValuePair `xml:"enumValuePairs"`
}

type ReportDefinitionRequest

type ReportDefinitionRequest struct {
	ReportType string `xml:"reportType"`
}

type ReportDefinitionService

type ReportDefinitionService struct {
	Auth
}

func NewReportDefinitionService

func NewReportDefinitionService(auth *Auth) *ReportDefinitionService

func (*ReportDefinitionService) GetReportFields

func (s *ReportDefinitionService) GetReportFields(report string) (fields []ReportDefinitionField, err error)

type ReportDownloadService

type ReportDownloadService struct {
	Auth
}

func NewReportDownloadService

func NewReportDownloadService(auth *Auth) *ReportDownloadService

func (*ReportDownloadService) AWQL

func (s *ReportDownloadService) AWQL(awql string, fmt string) (res interface{}, err error)

func (*ReportDownloadService) Get

func (s *ReportDownloadService) Get(reportDefinition ReportDefinition) (res interface{}, err error)

type ResponsiveDisplayAd

type ResponsiveDisplayAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	MarketingImage      Media                   `xml:"marketingImage"`
	LogoImage           Media                   `xml:"logoImage"`
	ShortHeadline       string                  `xml:"shortHeadline"`
	LongHeadline        string                  `xml:"longHeadline"`
	Description         string                  `xml:"description"`
	BusinessName        string                  `xml:"businessName"`
	ExperimentData      AdGroupExperimentData   `xml:"-"`
	Status              string                  `xml:"-"`
	Labels              []Label                 `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
	BaseCampaignId      int64                   `xml:"-"`
	BaseAdGroupId       int64                   `xml:"-"`
}

type Rule

type Rule struct {
	Groups []RuleItemGroup `xml:"groups"`
}

type RuleItemGroup

type RuleItemGroup struct {
	Items []interface{} `xml:"items"`
}

type SearchParameter

type SearchParameter interface{}

type SearchVolumeSearchParameter

type SearchVolumeSearchParameter struct {
	Minimum int `xml:"operation>minimum"`
	Maximum int `xml:"operation>maximum"`
}

type SeedAdGroupIdSearchParameter

type SeedAdGroupIdSearchParameter struct {
	AdGroupID int64 `xml:"adGroupId"`
}

type Selector

type Selector struct {
	XMLName    xml.Name
	Fields     []string    `xml:"fields"`
	Predicates []Predicate `xml:"predicates"`
	DateRange  *DateRange  `xml:"dateRange,omitempty"`
	Ordering   []OrderBy   `xml:"ordering"`
	Paging     *Paging     `xml:"paging,omitempty"`
}

type ServiceUrl

type ServiceUrl struct {
	Url  string
	Name string
}

func (ServiceUrl) String

func (s ServiceUrl) String() string

type ShallowAdGroup

type ShallowAdGroup struct {
	Id   int64  `xml:"id"`
	Name string `xml:"name"`
}

type ShallowAdGroupAd

type ShallowAdGroupAd struct {
	Id   int64  `xml:"id"`
	Name string `xml:"name"`
}

type ShallowAdGroupAdService

type ShallowAdGroupAdService struct {
	Auth
}

func NewShallowAdGroupAdService

func NewShallowAdGroupAdService(auth *Auth) *ShallowAdGroupAdService

func (*ShallowAdGroupAdService) Get

func (s *ShallowAdGroupAdService) Get(selector Selector) (adGroupAds []ShallowAdGroupAd, totalCount int64, err error)

type ShallowAdGroupService

type ShallowAdGroupService struct {
	Auth
}

func NewShallowAdGroupService

func NewShallowAdGroupService(auth *Auth) *ShallowAdGroupService

func (*ShallowAdGroupService) Get

func (s *ShallowAdGroupService) Get(selector Selector) (adGroups []ShallowAdGroup, totalCount int64, err error)

type ShallowCampaign

type ShallowCampaign struct {
	Id   int64  `xml:"id"`
	Name string `xml:"name"`
}

type ShallowCampaignService

type ShallowCampaignService struct {
	Auth
}

func NewShallowCampaignService

func NewShallowCampaignService(auth *Auth) *ShallowCampaignService

func (*ShallowCampaignService) Get

func (s *ShallowCampaignService) Get(selector Selector) (campaigns []ShallowCampaign, totalCount int64, err error)

type SharedCriterionService

type SharedCriterionService struct {
	Auth
}

func NewSharedCriterionService

func NewSharedCriterionService(auth *Auth) *SharedCriterionService

type SharedSetService

type SharedSetService struct {
	Auth
}

func NewSharedSetService

func NewSharedSetService(auth *Auth) *SharedSetService

type StatsEstimate

type StatsEstimate struct {
	AverageCpc        int64   `xml:"averageCpc>microAmount"`
	AveragePosition   float64 `xml:"averagePosition"`
	ClickThroughRate  float64 `xml:"clickThroughRate"`
	ClicksPerDay      float64 `xml:"clicksPerDay"`
	ImpressionsPerDay float64 `xml:"impressionsPerDay"`
	TotalCost         int64   `xml:"totalCost>microAmount"`
}

type StringAttribute

type StringAttribute struct {
	Value string `xml:"value"`
}

type StringMapEntry

type StringMapEntry struct {
	Key   string `xml:"key"`
	Value string `xml:"value"`
}

type StringRuleItem

type StringRuleItem struct {
	Key   string `xml:"key>name"`
	Op    string `xml:"op"` // "UNKNOWN", "CONTAINS", "EQUALS", "STARTS_WITH", "ENDS_WITH", "NOT_EQUAL", "NOT_CONTAIN", "NOT_START_WITH", "NOT_END_WITH"
	Value string `xml:"string"`
}

type SystemFeedGenerationData

type SystemFeedGenerationData struct {
	SystemFeedGenerationDataType string `xml:"https://adwords.google.com/api/adwords/cm/v201809 SystemFeedGenerationData.Type,omitempty"`
}

Configuration data allowing feed items to be populated for a system feed. https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.SystemFeedGenerationData

type TargetError

type TargetError struct {
	FieldPath   string `xml:"fieldPath"`
	Trigger     string `xml:"trigger"`
	ErrorString string `xml:"errorString"`
	Reason      string `xml:"reason"`
}

type TargetSettingDetail

type TargetSettingDetail struct {
	CriterionTypeGroup string `xml:"criterionTypeGroup"`
	TargetAll          bool   `xml:"targetAll"`
}

type TargetingIdea

type TargetingIdea struct {
	Key   string    `xml:"key"`
	Value Attribute `xml:"value"`
}

func (*TargetingIdea) UnmarshalXML

func (ti *TargetingIdea) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) (err error)

type TargetingIdeaSelector

type TargetingIdeaSelector struct {
	SearchParameters        []SearchParameter `xml:"searchParameters"`
	IdeaType                string            `xml:"ideaType"`
	RequestType             string            `xml:"requestType"`
	RequestedAttributeTypes []string          `xml:"requestedAttributeTypes"`
	Paging                  Paging            `xml:"paging"`
	LocaleCode              string            `xml:"localeCode,omitempty"`
	CurrencyCode            string            `xml:"currencyCode,omitempty"`
}

TargetingIdeaSelector A descriptor for finding TargetingIdeas that match the specified criteria. https://developers.google.com/adwords/api/docs/reference/v201809/TargetingIdeaService.TargetingIdeaSelector

func (TargetingIdeaSelector) MarshalXML

func (tis TargetingIdeaSelector) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TargetingIdeaService

type TargetingIdeaService struct {
	Auth
}

TargetingIdeaService Use this service to generate new keyword ideas based on the parameters specified in the selector. See the TargetingIdeaSelector documentation for more details. You can also use this service to retrieve statistics for existing keyword ideas by setting the selector's requestType to RequestType.STATS and passing in the appropriate search parameters.

func NewTargetingIdeaService

func NewTargetingIdeaService(auth *Auth) *TargetingIdeaService

NewTargetingIdeaService returns a new TargetingIdeaService

func (*TargetingIdeaService) Get

func (s *TargetingIdeaService) Get(selector TargetingIdeaSelector) (targetingIdeas []TargetingIdeas, totalCount int64, err error)

Get Returns a page of ideas that match the query described by the specified TargetingIdeaSelector. https://developers.google.com/adwords/api/docs/reference/v201809/TargetingIdeaService

type TargetingIdeas

type TargetingIdeas struct {
	TargetingIdea []TargetingIdea `xml:"data"`
}

type TemplateAd

type TemplateAd struct {
	AdGroupId           int64             `xml:"-"`
	Id                  int64             `xml:"id,omitempty"`
	Url                 string            `xml:"url"`
	DisplayUrl          string            `xml:"displayUrl"`
	FinalUrls           []string          `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string          `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl          `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string            `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters `xml:"urlCustomParameters,omitempty"`
	Type                string            `xml:"type,omitempty"`
	DevicePreference    int64             `xml:"devicePreference,omitempty"`
	TemplateId          int64             `xml:"templateId"`
	AdUnionId           int64             `xml:"adUnionId>id"`
	TemplateElements    []TemplateElement `xml:"templateElements"`
	Dimensions          []Dimensions      `xml:"dimensions"`
	Name                string            `xml:"name"`
	Duration            int64             `xml:"duration"`

	Status        string                  `xml:"-"`
	Labels        []Label                 `xml:"-"`
	PolicySummary *AdGroupAdPolicySummary `xml:"-"`
	// contains filtered or unexported fields
}

type TemplateElement

type TemplateElement struct {
	UniqueName string                 `xml:"uniqueName"`
	Fields     []TemplateElementField `xml:"fields"`
}

type TemplateElementField

type TemplateElementField struct {
	Name       string `xml:"name"`
	Type       string `xml:"type"`
	FieldText  string `xml:"fieldText"`
	FieldMedia string `xml:"fieldMedia"`
}

type TemporaryUrl

type TemporaryUrl struct {
	Url        string `xml:"url"`
	Expiration string `xml:"expiration,"`
}

type TextAd

type TextAd struct {
	AdGroupId           int64                   `xml:"-"`
	Id                  int64                   `xml:"id,omitempty"`
	Url                 string                  `xml:"url"`
	DisplayUrl          string                  `xml:"displayUrl"`
	FinalUrls           []string                `xml:"finalUrls,omitempty"`
	FinalMobileUrls     []string                `xml:"finalMobileUrls,omitempty"`
	FinalAppUrls        []AppUrl                `xml:"finalAppUrls,omitempty"`
	TrackingUrlTemplate string                  `xml:"trackingUrlTemplate,omitempty"`
	UrlCustomParameters *CustomParameters       `xml:"urlCustomParameters,omitempty"`
	Type                string                  `xml:"type,omitempty"`
	DevicePreference    int64                   `xml:"devicePreference,omitempty"`
	Headline            string                  `xml:"headline"`
	Description1        string                  `xml:"description1"`
	Description2        string                  `xml:"description2"`
	Status              string                  `xml:"-"`
	PolicySummary       *AdGroupAdPolicySummary `xml:"-"`
	Labels              []Label                 `xml:"-"`
}

func NewTextAd

func NewTextAd(adGroupId int64, url, displayUrl, headline, description1, description2, status string) TextAd

type TrafficEstimatorSelector

type TrafficEstimatorSelector struct {
	CampaignEstimateRequests []CampaignEstimateRequest `xml:"campaignEstimateRequests"`
}

type TrafficEstimatorService

type TrafficEstimatorService struct {
	Auth
}

func NewTrafficEstimatorService

func NewTrafficEstimatorService(auth *Auth) *TrafficEstimatorService

func (*TrafficEstimatorService) Get

Get returns an array of CampaignEstimates, holding AdGroupEstimates which hold KeywordEstimates, which hold the minimum and maximum values based on the requested keywords.

Example

keywordEstimateRequests := []KeywordEstimateRequest{
	KeywordEstimateRequest{
		KeywordCriterion{
			Text:      "mars cruise",
			MatchType: "BROAD",
		},
	},
	KeywordEstimateRequest{
		KeywordCriterion{
			Text:      "cheap cruise",
			MatchType: "EXACT",
		},
	},
	KeywordEstimateRequest{
		KeywordCriterion{
			Text:      "cruise",
			MatchType: "EXACT",
		},
	},
}

adGroupEstimateRequests := []AdGroupEstimateRequest{
	AdGroupEstimateRequest{
		KeywordEstimateRequests: keywordEstimateRequests,
		MaxCpc:                  1000000,
	},
}

campaignEstimateRequests := []CampaignEstimateRequest{
	CampaignEstimateRequest{
		AdGroupEstimateRequests: adGroupEstimateRequests,
	},
}

estimates, err := trafficEstimatorService.Get(TrafficEstimatorSelector{
	CampaignEstimateRequests: campaignEstimateRequests,
})

if err != nil {
	panic(err)
}

for _, estimate := range estimates {
	for _, adGroupEstimate := range estimate.AdGroupEstimates {
		for _, keywordEstimate := range adGroupEstimate.KeywordEstimates {
			fmt.Printf("Avg cpc: %d", keywordEstimate.Min.AverageCpc)
		}
	}
}

Relevant documentation

https://developers.google.com/adwords/api/docs/reference/v201809/TrafficEstimatorService#get

type TrialService

type TrialService struct {
	Auth
}

func NewTrialService

func NewTrialService(auth *Auth) *TrialService

type UrlError

type UrlError struct {
	EntityError
}

type UserInterestCriterion

type UserInterestCriterion struct {
	Id   int64  `xml:"userInterestId,omitempty"`
	Name string `xml:"userInterestName"`
}

type UserList

type UserList struct {
	Id                    int64   `xml:"id,omitempty"`
	Readonly              *bool   `xml:"isReadOnly"`
	Name                  string  `xml:"name"`
	Description           string  `xml:"description"`
	Status                string  `xml:"status"` // membership status "OPEN", "CLOSED"
	IntegrationCode       string  `xml:"integrationCode"`
	AccessReason          string  `xml:"accessReason"`          // account access resson "OWNER", "SHARED", "LICENSED", "SUBSCRIBED"
	AccountUserListStatus string  `xml:"accountUserListStatus"` // if share is still active "ACTIVE", "INACTIVE"
	MembershipLifeSpan    int64   `xml:"membershipLifeSpan"`    // number of days cookie stays on list
	Size                  *int64  `xml:"size,omitempty"`
	SizeRange             *string `xml:"sizeRange,omitempty"`          // size range "LESS_THEN_FIVE_HUNDRED","LESS_THAN_ONE_THOUSAND", "ONE_THOUSAND_TO_TEN_THOUSAND","TEN_THOUSAND_TO_FIFTY_THOUSAND","FIFTY_THOUSAND_TO_ONE_HUNDRED_THOUSAND","ONE_HUNDRED_THOUSAND_TO_THREE_HUNDRED_THOUSAND","THREE_HUNDRED_THOUSAND_TO_FIVE_HUNDRED_THOUSAND","FIVE_HUNDRED_THOUSAND_TO_ONE_MILLION","ONE_MILLION_TO_TWO_MILLION","TWO_MILLION_TO_THREE_MILLION","THREE_MILLION_TO_FIVE_MILLION","FIVE_MILLION_TO_TEN_MILLION","TEN_MILLION_TO_TWENTY_MILLION","TWENTY_MILLION_TO_THIRTY_MILLION","THIRTY_MILLION_TO_FIFTY_MILLION","OVER_FIFTY_MILLION"
	SizeForSearch         *int64  `xml:"sizeForSearch,omitempty"`      // estimated number of google.com users in this group
	SizeRangeForSearch    *string `xml:"sizeRangeForSearch,omitempty"` // same values as size range but for search
	ListType              *string `xml:"sizeType,omitempty"`           // one of "UNKNOWN", "REMARKETING", "LOGICAL", "EXTERNAL_REMARKETING", "RULE_BASED", "SIMILAR"

	// LogicalUserList
	LogicalRules *[]UserListLogicalRule `xml:"rules,omitempty"`

	// BasicUserList
	ConversionTypes *[]UserListConversionType `xml:"conversionTypes"`

	// RuleUserList
	Rule      *Rule   `xml:"rule,omitempty"`
	StartDate *string `xml:"startDate,omitempty"`
	EndDate   *string `xml:"endDate,omitempty"`

	// SimilarUserList
	SeedUserListId          *int64  `xml:"seedUserListId,omitempty"`
	SeedUserListName        *string `xml:"seedUserListName,omitempty"`
	SeedUserListDescription *string `xml:"seedUserListDescription,omitempty"`
	SeedUserListStatus      *string `xml:"seedUserListStatus,omitempty"`
	SeedListSize            *int64  `xml:"seedListSize,omitempty"`

	// CrmBasedUserList
	OptOutLink    *string `xml:"optOutLink,omitempty"`
	AppID         string  `xml:"appId,omitempty"`
	UploadKeyType string  `xml:"uploadKeyType,omitempty"`

	// Keep track of xsi:type for mutate and mutateMembers
	Xsi_type string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr,omitempty"`
}

func NewBasicUserList

func NewBasicUserList(name, description, status, integrationCode string, membershipLifeSpan int64, conversionTypes []UserListConversionType) (adwordsUserList UserList)

func NewCrmBasedUserList

func NewCrmBasedUserList(appID, uploadKeyType, name, description string, membershipLifeSpan int64, optOutLink string) (adwordsUserList UserList)

func NewDateSpecificRuleUserList

func NewDateSpecificRuleUserList(name, description, status, integrationCode string, membershipLifeSpan int64, rule Rule, startDate, endDate string) (adwordsUserList UserList)

func NewExpressionRuleUserList

func NewExpressionRuleUserList(name, description, status, integrationCode string, membershipLifeSpan int64, rule Rule) (adwordsUserList UserList)

func NewLogicalUserList

func NewLogicalUserList(name, description, status, integrationCode string, membershipLifeSpan int64, logicalRules []UserListLogicalRule) (adwordsUserList UserList)

func NewSimilarUserList

func NewSimilarUserList(name, description, status, integrationCode string, membershipLifeSpan int64) (adwordsUserList UserList)

type UserListConversionType

type UserListConversionType struct {
	Id       *int64
	Name     string
	Category *string `xml:"category"` // "BOOMERANG_EVENT", "OTHER"
}

type UserListCriterion

type UserListCriterion struct {
	Id                       int64  `xml:"id,omitempty"`
	UserListId               int64  `xml:"userListId"`
	UserListName             string `xml:"userListName"`
	UserListMembershipStatus string `xml:"userListMembershipStatus"`
}

type UserListLogicalRule

type UserListLogicalRule struct {
	Operator     string     `xml:"operator"` // "ALL", "ANY", "NONE", "UNKNOWN"
	RuleOperands []UserList `xml:"ruleOperands"`
}

type UserListOperations

type UserListOperations struct {
	XMLName    xml.Name
	Operations []Operation `xml:"operations"`
}

type VerticalCriterion

type VerticalCriterion struct {
	Id       int64    `xml:"verticalId,omitempty"`
	ParentId int64    `xml:"verticalParentId"`
	Path     []string `xml:"path"`
}

type WebpageCondition

type WebpageCondition struct {
	Operand  string `xml:"operand"`
	Argument string `xml:"argument"`
}

type WebpageCriterion

type WebpageCriterion struct {
	Id               int64            `xml:"id,omitempty"`
	Parameter        WebpageParameter `xml:"parameter"`
	CriteriaCoverage float64          `xml:"criteriaCoverage"`
	CriteriaSamples  []string         `xml:"criteriaSamples"`
}

type WebpageDescriptor

type WebpageDescriptor struct {
	Url   string `xml:"url"`
	Title string `xml:"title"`
}

type WebpageDescriptorAttribute

type WebpageDescriptorAttribute struct {
	Value WebpageDescriptor `xml:"value"`
}

type WebpageParameter

type WebpageParameter struct {
	CriterionName string             `xml:"criterionName"`
	Conditions    []WebpageCondition `xml:"conditions"`
}

Directories

Path Synopsis
setup_oauth2 is a tool for creating a gads configuration file config.json from the installed application credential stored in credentials.json.
setup_oauth2 is a tool for creating a gads configuration file config.json from the installed application credential stored in credentials.json.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL