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 ¶
- Constants
- Variables
- type AWQLClient
- type AWQLFormat
- type AWQLQuery
- type AWQLRequest
- type Ad
- type AdError
- type AdGroup
- type AdGroupAd
- type AdGroupAdLabel
- type AdGroupAdLabelOperations
- type AdGroupAdOperations
- type AdGroupAdService
- func (s AdGroupAdService) Get(selector Selector) (adGroupAds AdGroupAds, totalCount int64, err error)
- func (s *AdGroupAdService) Mutate(adGroupAdOperations AdGroupAdOperations) (adGroupAds AdGroupAds, err error)
- func (s *AdGroupAdService) MutateLabel(adGroupAdLabelOperations AdGroupAdLabelOperations) (adGroupAdLabels []AdGroupAdLabel, err error)
- func (s *AdGroupAdService) Query(query string) (adGroupAds AdGroupAds, totalCount int64, err error)
- type AdGroupAds
- type AdGroupBidModifier
- type AdGroupBidModifierOperations
- type AdGroupBidModifierService
- type AdGroupCriterionLabel
- type AdGroupCriterionLabelOperations
- type AdGroupCriterionOperations
- type AdGroupCriterionService
- func (s AdGroupCriterionService) Get(selector Selector) (adGroupCriterions AdGroupCriterions, totalCount int64, err error)
- func (s *AdGroupCriterionService) Mutate(adGroupCriterionOperations AdGroupCriterionOperations) (adGroupCriterions AdGroupCriterions, err error)
- func (s *AdGroupCriterionService) MutateLabel(adGroupCriterionLabelOperations AdGroupCriterionLabelOperations) (adGroupCriterionLabels []AdGroupCriterionLabel, err error)
- func (s *AdGroupCriterionService) Query(query string) (adGroupCriterions AdGroupCriterions, err error)
- type AdGroupCriterions
- type AdGroupFeed
- type AdGroupFeedOperations
- type AdGroupFeedService
- func (s AdGroupFeedService) Get(selector Selector) (adGroupFeeds []AdGroupFeed, err error)
- func (s *AdGroupFeedService) Mutate(adGroupFeedOperations AdGroupFeedOperations) (adGroupFeeds []AdGroupFeed, err error)
- func (s *AdGroupFeedService) Query(query string) (adGroupFeeds []AdGroupFeed, err error)
- type AdGroupLabel
- type AdGroupLabelOperations
- type AdGroupOperations
- type AdGroupService
- func (s *AdGroupService) Get(selector Selector) (adGroups []AdGroup, totalCount int64, err error)
- func (s *AdGroupService) Mutate(adGroupOperations AdGroupOperations) (adGroups []AdGroup, err error)
- func (s *AdGroupService) MutateLabel(adGroupLabelOperations AdGroupLabelOperations) (adGroupLabels []AdGroupLabel, err error)
- func (s *AdGroupService) Query(query string) (adGroups []AdGroup, err error)
- type AdGroupServiceError
- type AdParam
- type AdParamService
- type AdScheduleCriterion
- type AdSetting
- type AdWordsConversionTracker
- type Address
- type AdwordsUserListService
- type AgeRangeCriterion
- type ApiExceptionFault
- type AppUrl
- type Auth
- type AuthConfig
- type AwqlApiError
- type AwqlError
- type BaseResponse
- type Bid
- type BiddableAdGroupCriterion
- type BiddingScheme
- type BiddingSchemeInterface
- type BiddingStrategyConfiguration
- type BiddingStrategyOperations
- type BiddingStrategyService
- type Budget
- type BudgetError
- type BudgetOperations
- type BudgetOrderService
- type BudgetService
- type Campaign
- type CampaignAdExtensionService
- type CampaignCriterion
- type CampaignCriterionOperations
- type CampaignCriterionService
- func (s *CampaignCriterionService) Get(selector Selector) (campaignCriterions CampaignCriterions, totalCount int64, err error)
- func (s *CampaignCriterionService) Mutate(campaignCriterionOperations CampaignCriterionOperations) (campaignCriterions CampaignCriterions, err error)
- func (s *CampaignCriterionService) Query(query string) (campaignCriterions CampaignCriterions, err error)
- type CampaignCriterions
- type CampaignExtensionSetting
- type CampaignExtensionSettingOperations
- type CampaignExtensionSettingService
- func (s *CampaignExtensionSettingService) Get(selector Selector) (extensionSettings []CampaignExtensionSetting, totalCount int64, err error)
- func (s *CampaignExtensionSettingService) Mutate(campaignExtensionSettingOperations CampaignExtensionSettingOperations) (campaignExtensionSettings []CampaignExtensionSetting, err error)
- func (s *CampaignExtensionSettingService) Query(query string) (campaignExtensionSettings []CampaignExtensionSetting, totalCount int64, ...)
- type CampaignFeedService
- type CampaignLabel
- type CampaignLabelOperations
- type CampaignOperations
- type CampaignService
- func (s *CampaignService) Get(selector Selector) (campaigns []Campaign, totalCount int64, err error)
- func (s *CampaignService) Mutate(campaignOperations CampaignOperations) (campaigns []Campaign, err error)
- func (s *CampaignService) MutateLabel(campaignLabelOperations CampaignLabelOperations) (campaignLabels []CampaignLabel, err error)
- func (s *CampaignService) Query(query string) (campaigns []Campaign, totalCount int64, err error)
- type CampaignSetting
- func NewDynamicSearchAdsSetting(domainName, languageCode string) CampaignSetting
- func NewGeoTargetTypeSetting(positiveGeoTargetType, negativeGeoTargetType string) CampaignSetting
- func NewRealTimeBiddingSetting(optIn bool) CampaignSetting
- func NewShoppingSetting(merchantID int64, salesCountry string, campaignPriority int, enableLocal bool) CampaignSetting
- func NewTrackingSetting(trackingUrl string) CampaignSetting
- type CampaignSharedSetService
- type CarrierCriterion
- type CommonAd
- type CommonConversionTracker
- type CommonExtensionFeedItem
- type ConstantDataService
- func (s *ConstantDataService) GetAgeRangeCriterion() (ageRanges []AgeRangeCriterion, err error)
- func (s *ConstantDataService) GetCarrierCriterion() (carriers []CarrierCriterion, err error)
- func (s *ConstantDataService) GetGenderCriterion() (genders []GenderCriterion, err error)
- func (s *ConstantDataService) GetLanguageCriterion() (languages []LanguageCriterion, err error)
- func (s *ConstantDataService) GetMobileDeviceCriterion() (mobileDevices []MobileDeviceCriterion, err error)
- func (s *ConstantDataService) GetOperatingSystemVersionCriterion() (operatingSystemVersions []OperatingSystemVersionCriterion, err error)
- func (s *ConstantDataService) GetProductBiddingCategoryDatas(selector Selector) (datas []ProductBiddingCategoryData, err error)
- func (s *ConstantDataService) GetUserInterestCriterion() (userInterests []UserInterestCriterion, err error)
- func (s *ConstantDataService) GetVerticalCriterion() (verticals []VerticalCriterion, err error)
- type ContentLabelCriterion
- type ConversionTracker
- type ConversionTrackerOperations
- type ConversionTrackerService
- type ConversionTrackers
- type Cpc
- type Criterion
- type CriterionBidLandscape
- type CriterionError
- type CustomParameter
- type CustomParameters
- type Customer
- type CustomerFeedService
- type CustomerService
- func (m *CustomerService) GetCustomers(s *Selector) (customers []Customer, err error)
- func (m *CustomerService) GetServiceLinks(s *Selector) (serviceLinks []ServiceLink, err error)
- func (m *CustomerService) Mutate(c Customer) (customer Customer, err error)
- func (s *CustomerService) MutateServiceLinks(ops ServiceLinkOperations) (links []ServiceLink, err error)
- type CustomerSyncService
- type DataService
- type Date
- type DateRange
- type DateRangeType
- type DateRuleItem
- type Dimensions
- type DownloadFormat
- type DynamicSearchAd
- type ErrorsType
- type ExpandedTextAd
- type ExperimentService
- type ExtensionFeedItem
- type ExtensionFeedItems
- type ExtensionSetting
- type Fault
- type FeedItem
- type FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeFinalMobileURLs(value []string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeFinalURLs(value []string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeLine1(value string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeLine2(value string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeText(value string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeTrackingURL(value string) FeedItemAttributeValue
- func NewSitelinkFeedItemAttributeURL(value string) FeedItemAttributeValue
- type FeedItemOperations
- type FeedItemService
- type FeedMappingService
- type FeedService
- type FinalURLs
- type FrequencyCap
- type GenderCriterion
- type GeoLocationService
- type GeoPoint
- type HasXSIType
- type ImageAd
- type ImageUrl
- type KeywordCriterion
- type Label
- type LabelOperations
- type LabelService
- type LandscapePoint
- type LanguageCriterion
- type LinkStatus
- type Location
- type LocationCriterion
- type LocationCriterionService
- type LocationCriterions
- type ManagedCustomer
- type ManagedCustomerLink
- type ManagedCustomerLinkOperations
- type ManagedCustomerLinkResult
- type ManagedCustomerMoveOperation
- type ManagedCustomerMoveOperations
- type ManagedCustomerService
- func (m *ManagedCustomerService) Get(selector Selector) (customers []ManagedCustomer, managedCustomerLinks []ManagedCustomerLink, ...)
- func (m *ManagedCustomerService) MutateLink(mcl ManagedCustomerLinkOperations) ([]*ManagedCustomerLink, error)
- func (m *ManagedCustomerService) MutateManager(mcmOps ManagedCustomerMoveOperations) (links []ManagedCustomerLink, err error)
- type Media
- type MediaService
- type MobileAppCategoryCriterion
- type MobileApplicationCriterion
- type MobileDeviceCriterion
- type MutateJobService
- type NegativeAdGroupCriterion
- type NegativeCampaignCriterion
- type NetworkSetting
- type NotEmptyError
- type NumberRuleItem
- type OfflineConversionService
- type OperatingSystemVersionCriterion
- type OperationError
- type OrderBy
- type Paging
- type PartialFailureError
- type PartialFailureErrors
- type PlacementCriterion
- type PlatformCriterion
- type Predicate
- type ProductAd
- type ProductBiddingCategoryData
- type ProductCondition
- type ProductCriterion
- type ProductDimension
- type ProductPartitionCriterion
- type ProximityCriterion
- type QualityInfo
- type RateExceededError
- type ReportDefinition
- type ReportDefinitionService
- type Rule
- type RuleItemGroup
- type Selector
- type ServiceLink
- type ServiceLinkOperations
- type ServiceUrl
- type SharedBiddingStrategy
- type SharedCriterionService
- type SharedSetService
- type SitelinkFeedItem
- type StringRuleItem
- type TargetError
- type TargetIdeaService
- type TargetRoasBiddingScheme
- type TargetSettingDetail
- type TemplateAd
- type TemplateElement
- type TemplateElementField
- type TextAd
- type TrafficEstimatorService
- type UnknownError
- type UrlList
- type UserInterestCriterion
- type UserList
- func NewBasicUserList(name, description, status, integrationCode string, membershipLifeSpan int64, ...) (adwordsUserList UserList)
- func NewDateSpecificRuleUserList(name, description, status, integrationCode string, membershipLifeSpan int64, ...) (adwordsUserList UserList)
- func NewExpressionRuleUserList(name, description, status, integrationCode string, membershipLifeSpan int64, ...) (adwordsUserList UserList)
- func NewLogicalUserList(name, description, status, integrationCode string, membershipLifeSpan int64, ...) (adwordsUserList UserList)
- func NewSimilarUserList(name, description, status, integrationCode string, membershipLifeSpan int64) (adwordsUserList UserList)
- type UserListConversionType
- type UserListCriterion
- type UserListLogicalRule
- type UserListOperations
- type VerticalCriterion
- type WebpageCondition
- type WebpageCriterion
- type WebpageParameter
Examples ¶
Constants ¶
const ( ProductPartitionCriterionTypeUnit = "UNIT" ProductPartitionCriterionTypeSubdivision = "SUBDIVISION" )
ProductPartitionCriterion is a criterion representing a group of items - Use the Type : ProductPartition
const ( // DownloadFormatXML is when you want xml in return, eventually parsable in the api in the future DownloadFormatXML DownloadFormat = "XML" // DownloadFormatXMLGzipped is when you want xml but compressed in gzip format DownloadFormatXMLGzipped DownloadFormat = "GZIPPED_XML" // DownloadFormatCSV is when you want pure csv in return, with the first line that contains DownloadFormatCSV DownloadFormat = "CSV" // DownloadFormatCSVGzipped is when you want csv but compressed in gzip DownloadFormatCSVGzipped DownloadFormat = "GZIPPED_CSV" // DownloadFormatTSV is when you want like csv but separated with tabs DownloadFormatTSV DownloadFormat = "TSV" // DateRangeTypeCustom is the type used when you specify manually the range of the report DateRangeTypeCustom DateRangeType = "CUSTOM_DATE" // DateRangeTypeToday represents the data of only today DateRangeTypeToday DateRangeType = "TODAY" // DateRangeTypeYesterday represents the data of only yesterday DateRangeTypeYesterday DateRangeType = "YESTERDAY" // DateRangeTypeLast7Days represents the data of only the last 7 days DateRangeTypeLast7Days DateRangeType = "LAST_7_DAYS" // DateRangeTypeLastWeek represents the data of only the last week DateRangeTypeLastWeek DateRangeType = "LAST_WEEK" // DateRangeTypeLastBusinessWeek represents the data of only the last business week DateRangeTypeLastBusinessWeek DateRangeType = "LAST_BUSINESS_WEEK" // DateRangeTypeThisMonth represents the data of only this month DateRangeTypeThisMonth DateRangeType = "THIS_MONTH" // DateRangeTypeAllTime represents the data of the all time (be careful) DateRangeTypeAllTime DateRangeType = "ALL_TIME" // DateRangeTypeLast14Days represents the data of only the last 14 days DateRangeTypeLast14Days DateRangeType = "LAST_14_DAYS" // DateRangeTypeLast30Days represents the data of only the last 30 days DateRangeTypeLast30Days DateRangeType = "LAST_30_DAYS" // DateRangeTypeThisWeekSunToday represents the data of only this week, from sunday to today DateRangeTypeThisWeekSunToday DateRangeType = "THIS_WEEK_SUN_TODAY" // DateRangeTypeThisWeekMonToday represents the data of only this week from monday to today DateRangeTypeThisWeekMonToday DateRangeType = "THIS_WEEK_MON_TODAY" // DateRangeTypeLastWeekSunSat represents the data of only the last week from sunday to saturday DateRangeTypeLastWeekSunSat DateRangeType = "LAST_WEEK_SUN_SAT" )
const ( // used for developpement, if true all unknown field will raise an error StrictMode = false )
Variables ¶
var ( // ErrorMissingCustomerId symbolizes that the library cant interrogate the api without a Client Customer Id ErrMissingCustomerId = errors.New("missing client customer id") // Reports ErrMissingReportName = errors.New("report must have a name") ErrMissingReportType = errors.New("report must have a type") ErrInvalidReportDownloadType = errors.New("report as an invalid DownloadType") )
var ( // exceptions ERROR_NOT_YET_IMPLEMENTED = fmt.Errorf("Not yet implemented") )
Functions ¶
This section is empty.
Types ¶
type AWQLClient ¶
type AWQLClient struct {
Auth
}
AWQLClient struct for AWQL caller
func NewAWQLClient ¶
func NewAWQLClient(auth *Auth) *AWQLClient
NewAWQLClient is a constructor for AWQLClient
func (*AWQLClient) Download ¶
func (a *AWQLClient) Download(awqlReq AWQLRequest) (io.ReadCloser, error)
Download downloads a report by awql request
type AWQLFormat ¶
type AWQLFormat string
AWQLFormat type for AWQL format
const ( AWQLFormatCSVForExcel AWQLFormat = "CSVFOREXCEL" AWQLFormatCSV AWQLFormat = "CSV" AWQLFormatTSV AWQLFormat = "TSV" AWQLFormatXML AWQLFormat = "XML" AWQLFormatGzippedCSV AWQLFormat = "GZIPPED_CSV" AWQLFormatGzippedXML AWQLFormat = "GZIPPED_XML" )
AWQL formats
type AWQLRequest ¶
type AWQLRequest struct { Query string Format AWQLFormat SkipReportHeader bool SkipColumnHeader bool SkipReportSummary bool IncludeZeroImpressions bool UseRawEnumValues bool }
AWQLRequest struct for awql request
type Ad ¶
type Ad interface { GetID() int64 GetURL() string GetType() string GetTrackingURLTemplate() *string GetFinalURLs() []string CloneForTemplate([]string, *string) Ad }
Ad is the common interface for accessing properties shared by all child types of ads
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"` TrackingUrlTemplate *string `xml:"trackingUrlTemplate,omitempty"` BiddingStrategyConfiguration []BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration,omitempty"` ContentBidCriterionTypeGroup *string `xml:"contentBidCriterionTypeGroup,omitempty"` }
type AdGroupAd ¶
type AdGroupAdLabel ¶
type AdGroupAdLabelOperations ¶
type AdGroupAdLabelOperations map[string][]AdGroupAdLabel
type AdGroupAdOperations ¶
type AdGroupAdOperations map[string]AdGroupAds
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.Ad.(TextAd) fmt.Printf("Ad ID is %d, type is 'TextAd' and status is '%s'", ta.GetID(), aga.Status) } // Increment values to request the next page. offset += pageSize paging.Offset = offset if totalCount < offset { break } } fmt.Printf("\tAd group ID %d has %d ad(s).", 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.NewAdGroupTextAd( 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": { NewAdGroupExpandedTextAd( adGroupId, "http://www.example.com", "Luxury Cruise to Mars", "Visit the Red Planet in style.", "Low-gravity fun for everyone!", "ACTIVE", ), NewAdGroupExpandedTextAd( adGroupId, "http://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 { fmt.Printf("\tAd ID %d, type 'TextAd' and status '%s'", ada.Ad.GetID(), ada.Status) } } // This example illustrates how to update an ad, setting its status to 'PAUSED'. textAdId := adGroupAds[0].Ad.GetID() adGroupAds, err = agas.Mutate( AdGroupAdOperations{ "SET": { AdGroupAd{ AdGroupId: adGroupId, Status: "PAUSED", Ad: CommonAd{ID: textAdId}, }, }, }, ) if err != nil { fmt.Printf("No ads were updated.") } else { textAd := adGroupAds[0] fmt.Printf("Ad ID %d was successfully updated, status set to '%s'.", textAd.Ad.GetID(), textAd.Status) } // This example removes an ad using the 'REMOVE' operator. adGroupAds, err = agas.Mutate( AdGroupAdOperations{ "SET": { AdGroupAd{ AdGroupId: adGroupId, Status: "PAUSED", Ad: CommonAd{ID: textAdId}, }, }, }, ) if err != nil { fmt.Printf("No ads were removed.") } else { textAd := adGroupAds[0] fmt.Printf("Ad ID %d was successfully removed.", textAd.Ad.GetID()) }
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 []AdGroupAd
func (AdGroupAds) GetAds ¶
func (agads AdGroupAds) GetAds() (ads []Ad)
func (*AdGroupAds) UnmarshalXML ¶
func (agas *AdGroupAds) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
type AdGroupBidModifier ¶
type AdGroupBidModifier struct { CampaignId int64 `xml:"campaignId"` AdGroupId int64 `xml:"adGroupId"` Criterion Criterion `xml:"criterion"` BidModifier float64 `xml:"bidModifier"` BidModifierSource string `xml:"bidModifierSource"` }
func (*AdGroupBidModifier) UnmarshalXML ¶
func (cc *AdGroupBidModifier) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
type AdGroupBidModifierOperations ¶
type AdGroupBidModifierOperations map[string][]AdGroupBidModifier
type AdGroupBidModifierService ¶
type AdGroupBidModifierService struct {
Auth
}
func NewAdGroupBidModifierService ¶
func NewAdGroupBidModifierService(auth *Auth) *AdGroupBidModifierService
func (*AdGroupBidModifierService) Get ¶
func (s *AdGroupBidModifierService) Get(selector Selector) (bm []AdGroupBidModifier, totalCount int64, err error)
Get returns budgets matching a given selector and the total count of matching budgets.
func (*AdGroupBidModifierService) Mutate ¶
func (s *AdGroupBidModifierService) Mutate(bidmOperations AdGroupBidModifierOperations) (resp []AdGroupBidModifier, err error)
Mutate takes a budgetOperations and creates, modifies or destroys the associated budgets.
type AdGroupCriterionLabel ¶
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 %d has %d keyword(s).", 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, err error)
Query is not yet implemented
Relevant 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 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 AdGroupLabelOperations ¶
type AdGroupLabelOperations map[string][]AdGroupLabel
type AdGroupOperations ¶
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 '%s' and ID is %d", ag.Id, ag.Name) } // Increment values to request the next page. offset += pageSize paging.Offset = offset if totalCount < offset { break } } fmt.Printf("\tCampaign ID %d 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: "MANUAL_CPC", 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
type AdGroupServiceError ¶
type AdParamService ¶
type AdParamService struct {
Auth
}
func NewAdParamService ¶
func NewAdParamService(auth *Auth) *AdParamService
type AdScheduleCriterion ¶
type AdScheduleCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` DayOfWeek string `xml:"dayOfWeek,omitempty"` StartHour string `xml:"startHour,omitempty"` StartMinute string `xml:"startMinute,omitempty"` EndHour string `xml:"endHour,omitempty"` EndMinute string `xml:"endMinute,omitempty"` }
AdScheduleCriterion struct 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
func (AdScheduleCriterion) GetID ¶
func (c AdScheduleCriterion) GetID() int64
func (AdScheduleCriterion) GetType ¶
func (c AdScheduleCriterion) GetType() string
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"` }
func NewAdGroupTargetSetting ¶
func NewAdGroupTargetSetting(s []TargetSettingDetail) AdSetting
type AdWordsConversionTracker ¶
type AdWordsConversionTracker struct { *CommonConversionTracker Type string `xml:"xsi:type,attr,omitempty"` TextFormat string `xml:"textFormat,omitempty"` ConversionPageLanguage string `xml:"ConversionPageLanguage,omitempty"` BackgroundColor string `xml:"backgroundColor,omitempty"` TrackingCodeType string `xml:"trackingCodeType,omitempty"` }
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 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 is not yet implemented
Relevant documentation
https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService#mutate
type AgeRangeCriterion ¶
type AgeRangeCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` 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
func (AgeRangeCriterion) GetID ¶
func (c AgeRangeCriterion) GetID() int64
func (AgeRangeCriterion) GetType ¶
func (c AgeRangeCriterion) GetType() string
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 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 (AuthConfig) Save ¶
func (c AuthConfig) Save() error
Save writes the contents of AuthConfig back to the JSON file it was loaded from.
type AwqlApiError ¶
type AwqlError ¶
type AwqlError struct { XMLName xml.Name `xml:"reportDownloadError"` Error AwqlApiError `xml:"ApiError"` }
type BaseResponse ¶
type BaseResponse struct {
PartialFailureErrors PartialFailureErrors `xml:"rval>partialFailureErrors,omitempty"`
}
BaseResponse is the common structure of every response received from Google Adwords in the most common case
type BiddableAdGroupCriterion ¶
type BiddableAdGroupCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` AdGroupId int64 `xml:"adGroupId"` 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"` FirstPageCpc *Cpc `xml:"firstPageCpc>amount,omitempty"` TopOfPageCpc *Cpc `xml:"topOfPageCpc>amount,omitempty"` QualityInfo *QualityInfo `xml:"qualityInfo,omitempty"` BiddingStrategyConfiguration *BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration,omitempty"` BidModifier float64 `xml:"bidModifier,omitempty"` FinalUrls *FinalURLs `xml:"finalUrls,omitempty"` FinalMobileUrls []string `xml:"finalMobileUrls,omitempty"` FinalAppUrls []string `xml:"finalAppUrls,omitempty"` TrackingUrlTemplate *string `xml:"trackingUrlTemplate"` UrlCustomParameters *CustomParameters `xml:"urlCustomParameters,omitempty"` }
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"` }
BiddingScheme struct for ManualCpcBiddingScheme
func NewBiddingScheme ¶
func NewBiddingScheme(enhancedCpcEnabled bool) *BiddingScheme
NewBiddingScheme returns new instance of BiddingScheme
func (*BiddingScheme) GetType ¶
func (s *BiddingScheme) GetType() string
GetType return type of bidding scheme
type BiddingSchemeInterface ¶
type BiddingSchemeInterface interface {
GetType() string
}
BiddingSchemeInterface interface for bidding scheme
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 BiddingSchemeInterface `xml:"biddingScheme,omitempty"` Bids []Bid `xml:"bids"` }
func (*BiddingStrategyConfiguration) UnmarshalXML ¶
func (b *BiddingStrategyConfiguration) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML special unmarshal for the different bidding schemes
type BiddingStrategyOperations ¶
type BiddingStrategyOperations map[string][]SharedBiddingStrategy
A BiddingStrategyOperations maps operations to the bidding strategy they will be performed on. BiddingStrategy operations can be 'ADD', 'REMOVE' or 'SET'
type BiddingStrategyService ¶
type BiddingStrategyService struct {
Auth
}
BiddingStrategyService servie for bidding strategies
func NewBiddingStrategyService ¶
func NewBiddingStrategyService(auth *Auth) *BiddingStrategyService
NewBiddingStrategyService returns new instance of BiddingStrategyService
func (*BiddingStrategyService) Get ¶
func (s *BiddingStrategyService) Get(selector Selector) ([]SharedBiddingStrategy, int64, error)
Get returns budgets matching a given selector and the total count of matching budgets.
func (*BiddingStrategyService) Mutate ¶
func (s *BiddingStrategyService) Mutate(bidOperations BiddingStrategyOperations) ([]SharedBiddingStrategy, error)
Mutate takes a budgetOperations and creates, modifies or destroys the associated budgets.
type Budget ¶
type Budget struct { Id int64 `xml:"budgetId,omitempty"` // A unique identifier Name string `xml:"name"` // A descriptive name 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 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 BudgetOperations ¶
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 Campaign ¶
type Campaign struct { Id int64 `xml:"id,omitempty"` Name string `xml:"name,omitempty"` Status string `xml:"status,omitempty"` // Status: "ENABLED", "PAUSED", "REMOVED" ServingStatus *string `xml:"servingStatus,omitempty"` // ServingStatus: "SERVING", "NONE", "ENDED", "PENDING", "SUSPENDED" StartDate string `xml:"startDate,omitempty"` EndDate *string `xml:"endDate,omitempty"` BudgetId int64 `xml:"budget>budgetId,omitempty"` ConversionOptimizerEligibility *conversionOptimizerEligibility `xml:"conversionOptimizerEligibility,omitempty"` AdServingOptimizationStatus string `xml:"adServingOptimizationStatus,omitempty"` FrequencyCap *FrequencyCap `xml:"frequencyCap,omitempty"` 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,omitempty"` BiddingStrategyConfiguration *BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration,omitempty"` ForwardCompatibilityMap *map[string]string `xml:"forwardCompatibilityMap,omitempty"` TrackingUrlTemplate *string `xml:"trackingUrlTemplate,omitempty"` UrlCustomParameters *CustomParameters `xml:"urlCustomParameters,omitempty"` BaseCampaignID *int64 `xml:"baseCampaignId,omitempty"` CampaignTrialType *string `xml:"campaignTrialType,omitempty"` Errors []error `xml:"-"` }
type CampaignAdExtensionService ¶
type CampaignAdExtensionService struct {
Auth
}
func NewCampaignAdExtensionService ¶
func NewCampaignAdExtensionService(auth *Auth) *CampaignAdExtensionService
type CampaignCriterion ¶
type CampaignCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` CampaignId int64 `xml:"campaignId"` Criterion Criterion `xml:"criterion"` BidModifier *float64 `xml:"bidModifier,omitempty"` IsNegative bool `xml:"isNegative"` Errors []error `xml:"-"` }
func (CampaignCriterion) MarshalXML ¶
func (cc CampaignCriterion) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*CampaignCriterion) UnmarshalXML ¶
func (cc *CampaignCriterion) UnmarshalXML(dec *xml.Decoder, 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, err error)
type CampaignCriterions ¶
type CampaignCriterions []interface{}
func (*CampaignCriterions) UnmarshalXML ¶
func (ccs *CampaignCriterions) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
type CampaignExtensionSetting ¶
type CampaignExtensionSetting struct { CampaignID int64 `xml:"campaignId,omitempty"` ExtensionType string `xml:"extensionType"` ExtensionSetting *ExtensionSetting `xml:"extensionSetting"` }
CampaignExtensionSetting is used to add or modify extensions being served for the specified campaign.
func (*CampaignExtensionSetting) GetSitelinks ¶
func (c *CampaignExtensionSetting) GetSitelinks() (sitelinks []SitelinkFeedItem)
GetSitelinks is a conveniency methods to get the list of sitelinks out of the extension
type CampaignExtensionSettingOperations ¶
type CampaignExtensionSettingOperations map[string][]CampaignExtensionSetting
CampaignExtensionSettingOperations is a conveniency map on CampaignExtensionSetting to manipulate it can have the 3 following keys (case sensitive)
ADD SET REMOVE
type CampaignExtensionSettingService ¶
type CampaignExtensionSettingService struct {
Auth
}
CampaignExtensionSettingService (v201809) Service used to manage extensions at the campaign level. The extensions are managed by AdWords using existing feed services, including creating and modifying feeds, feed items, and campaign feeds for the user.
see https://developers.google.com/adwords/api/docs/reference/v201809/CampaignExtensionSettingService
func NewCampaignExtensionSettingService ¶
func NewCampaignExtensionSettingService(auth *Auth) *CampaignExtensionSettingService
NewCampaignExtensionSettingService is a constructor for CampaignExtensionSettingService
func (*CampaignExtensionSettingService) Get ¶
func (s *CampaignExtensionSettingService) Get(selector Selector) ( extensionSettings []CampaignExtensionSetting, totalCount int64, err error, )
Get returns an array of CampaignExtensionSettings' and the total number of CampaignExtensionSettings' matching the selector.
see https://developers.google.com/adwords/api/docs/reference/v201809/CampaignExtensionSettingService#get
func (*CampaignExtensionSettingService) Mutate ¶
func (s *CampaignExtensionSettingService) Mutate( campaignExtensionSettingOperations CampaignExtensionSettingOperations, ) (campaignExtensionSettings []CampaignExtensionSetting, err error)
Mutate allows you to add, modify and remove CampaignExtensionSetting, returning the modified ones.
func (*CampaignExtensionSettingService) Query ¶
func (s *CampaignExtensionSettingService) Query(query string) (campaignExtensionSettings []CampaignExtensionSetting, totalCount int64, err error)
Query allows to use AWQL to Get CampaignExtensionSettings matching the query
type CampaignFeedService ¶
type CampaignFeedService struct {
Auth
}
func NewCampaignFeedService ¶
func NewCampaignFeedService(auth *Auth) *CampaignFeedService
type CampaignLabel ¶
type CampaignLabelOperations ¶
type CampaignLabelOperations map[string][]CampaignLabel
type CampaignOperations ¶
type CampaignService ¶
type CampaignService struct {
Auth
}
CampaignService 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
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"` // ShoppingSetting MerchantId *int64 `xml:"merchantId,omitempty"` SalesCountry *string `xml:"salesCountry,omitempty"` CampaignPriority *int `xml:"campaignPriority"` EnableLocal *bool `xml:"enableLocal,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 NewShoppingSetting ¶
func NewShoppingSetting(merchantID int64, salesCountry string, campaignPriority int, enableLocal bool) CampaignSetting
func NewTrackingSetting ¶
func NewTrackingSetting(trackingUrl string) CampaignSetting
type CampaignSharedSetService ¶
type CampaignSharedSetService struct {
}func NewCampaignSharedSetService ¶
func NewCampaignSharedSetService(auth *Auth) *CampaignSharedSetService
type CarrierCriterion ¶
type CarrierCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Name string `xml:"name,emitempty"` CountryCode string `xml:"countryCode,emitempty"` }
func (CarrierCriterion) GetID ¶
func (c CarrierCriterion) GetID() int64
func (CarrierCriterion) GetType ¶
func (c CarrierCriterion) GetType() string
type CommonAd ¶
type CommonAd struct { Type string `xml:"xsi:type,attr,omitempty"` ID int64 `xml:"id,omitempty"` URL string `xml:"url,omitempty"` DisplayURL string `xml:"displayUrl,omitempty"` FinalURLs []string `xml:"finalUrls,omitempty"` FinalMobileURLs []string `xml:"finalMobileUrls,omitempty"` FinalAppURLs []AppUrl `xml:"finalAppUrls,omitempty"` TrackingURLTemplate *string `xml:"trackingUrlTemplate"` URLCustomParameters *CustomParameters `xml:"urlCustomParameters,omitempty"` DevicePreference int64 `xml:"devicePreference,omitempty"` }
CommonAd define the parent type Ad type as defined https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.Ad
func (CommonAd) CloneForTemplate ¶
CloneForTemplate create a clone of an Ad, to recreate it for changing the tracking Url Template (as Ad are immutable)
func (CommonAd) GetFinalURLs ¶
GetFinalURLs returns the list of Final urls (can be empty array)
func (CommonAd) GetTrackingURLTemplate ¶
GetTrackingURLTemplate returns the tracking url template
type CommonConversionTracker ¶
type CommonConversionTracker struct { ID string `xml:"id,omitempty"` OriginalConversionTypeID int64 `xml:"originalConversionTypeId,omitempty"` Name string `xml:"name,omitempty"` Status string `xml:"status,omitempty"` Category string `xml:"category,omitempty"` ConversionTypeOwnerCustomerID int64 `xml:"conversionTypeOwnerCustomerId,omitempty"` ViewthroughLookbackWindow int64 `xml:"viewthroughLookbackWindow,omitempty"` CtcLookbackWindow int64 `xml:"ctcLookbackWindow,omitempty"` CountingType string `xml:"countingType,omitempty"` DefaultRevenueValue float64 `xml:"defaultRevenueValue,omitempty"` DefaultRevenueCurrencyCode string `xml:"defaultRevenueCurrencyCode,omitempty"` AlwaysUseDefaultRevenueValue bool `xml:"alwaysUseDefaultRevenueValue,omitempty"` MostRecentConversionDate string `xml:"mostRecentConversionDate,omitempty"` LastReceivedRequestTime string `xml:"lastReceivedRequestTime,omitempty"` }
func (*CommonConversionTracker) GetID ¶
func (c *CommonConversionTracker) GetID() string
GetID getter for conversion tracker ID
func (*CommonConversionTracker) GetStatus ¶
func (c *CommonConversionTracker) GetStatus() string
GetStatus getter for conversion tracker status
func (*CommonConversionTracker) SetStatus ¶
func (c *CommonConversionTracker) SetStatus(status string)
SetStatus setter for conversion tracker status
type CommonExtensionFeedItem ¶
type CommonExtensionFeedItem struct { Type string `xml:"xsi:type,attr,omitempty"` FeedID int64 `xml:"feedId,omitempty"` FeedItemID int64 `xml:"feedItemId,omitempty"` Status string `xml:"status,omitempty"` FeedType string `xml:"feedType,omitempty"` StartTime string `xml:"startTime,omitempty"` EndTime *string `xml:"endTime"` }
CommonExtensionFeedItem is the Parent type for all ExtensionFeedItem
func (*CommonExtensionFeedItem) GetFeedID ¶
func (e *CommonExtensionFeedItem) GetFeedID() int64
GetFeedID returns the ID of the feed this item belongs to
func (*CommonExtensionFeedItem) GetFeedItemID ¶
func (e *CommonExtensionFeedItem) GetFeedItemID() int64
GetFeedItemID returns the ID of this feed item
func (*CommonExtensionFeedItem) GetType ¶
func (e *CommonExtensionFeedItem) GetType() string
GetType returns the type
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) GetProductBiddingCategoryDatas ¶
func (s *ConstantDataService) GetProductBiddingCategoryDatas(selector Selector) (datas []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 { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` ContentLabelType string `xml:"contentLabelType"` // ContentLabelType: "ADULTISH", "AFE", "BELOW_THE_FOLD", "CONFLICT", "DP", "EMBEDDED_VIDEO", "GAMES", "JACKASS", "PROFANITY", "UGC_FORUMS", "UGC_IMAGES", "UGC_SOCIAL", "UGC_VIDEOS", "SIRENS", "TRAGEDY", "VIDEO", "UNKNOWN" }
func (ContentLabelCriterion) GetID ¶
func (c ContentLabelCriterion) GetID() int64
func (ContentLabelCriterion) GetType ¶
func (c ContentLabelCriterion) GetType() string
type ConversionTracker ¶
ConversionTracker is an interface for conversion tackers
type ConversionTrackerOperations ¶
type ConversionTrackerOperations map[string][]ConversionTracker
type ConversionTrackerService ¶
type ConversionTrackerService struct {
Auth
}
func NewConversionTrackerService ¶
func NewConversionTrackerService(auth *Auth) *ConversionTrackerService
func (*ConversionTrackerService) Get ¶
func (s *ConversionTrackerService) Get(selector Selector) ( items ConversionTrackers, totalCount int64, err error, )
func (*ConversionTrackerService) Mutate ¶
func (s *ConversionTrackerService) Mutate( conversionTrackerOperations ConversionTrackerOperations, ) (conversionTrackers ConversionTrackers, err error)
type ConversionTrackers ¶
type ConversionTrackers []ConversionTracker
func (*ConversionTrackers) UnmarshalXML ¶
func (cts *ConversionTrackers) UnmarshalXML( dec *xml.Decoder, start xml.StartElement, ) error
type CriterionBidLandscape ¶
type CriterionBidLandscape struct { CampaignID uint64 `xml:"campaignId"` AdGroupID uint64 `xml:"adGroupId"` CriterionID uint64 `xml:"criterionId"` StartDate string `xml:"startDate"` EndDate string `xml:"endDate"` LandscapePoints []LandscapePoint `xml:"landscapePoints"` }
CriterionBidLandscape struct for CriterionBidLandscape
type CriterionError ¶
type CustomParameter ¶
type CustomParameters ¶
type CustomParameters struct { CustomParameters []CustomParameter `xml:"parameters"` DoReplace bool `xml:"doReplace"` }
type Customer ¶
type Customer struct { ID uint64 `xml:"customerId,omitempty"` CurrencyCode *string `xml:"currencyCode,omitempty"` DateTimeZone *string `xml:"dateTimeZone,omitempty"` DescriptiveName string `xml:"descriptiveName,omitempty"` CanManageClients bool `xml:"canManageClients,omitempty"` TestAccount bool `xml:"testAccount,omitempty"` AutoTaggingEnabled *bool `xml:"autoTaggingEnabled"` TrackingURLTemplate *string `xml:"trackingUrlTemplate"` }
Customer represents a customer in the Google Adwords API
type CustomerFeedService ¶
type CustomerFeedService struct {
Auth
}
func NewCustomerFeedService ¶
func NewCustomerFeedService(auth *Auth) *CustomerFeedService
type CustomerService ¶
type CustomerService struct {
Auth
}
CustomerService fetches or modify Customer properties
func NewCustomerService ¶
func NewCustomerService(auth *Auth) *CustomerService
NewCustomerService creates a CustomerService
func (*CustomerService) GetCustomers ¶
func (m *CustomerService) GetCustomers(s *Selector) ( customers []Customer, err error, )
Get fetches the managed customers of the current account
func (*CustomerService) GetServiceLinks ¶
func (m *CustomerService) GetServiceLinks(s *Selector) (serviceLinks []ServiceLink, err error)
GetServiceLinks fetches the service links
func (*CustomerService) Mutate ¶
func (m *CustomerService) Mutate(c Customer) (customer Customer, err error)
Mutate performs modifications of one or many customer
func (*CustomerService) MutateServiceLinks ¶
func (s *CustomerService) MutateServiceLinks(ops ServiceLinkOperations) (links []ServiceLink, err error)
type CustomerSyncService ¶
type CustomerSyncService struct {
Auth
}
func NewCustomerSyncService ¶
func NewCustomerSyncService(auth *Auth) *CustomerSyncService
type DataService ¶
type DataService struct {
Auth
}
DataService struct for service
func NewDataService ¶
func NewDataService(auth *Auth) *DataService
NewDataService returns new instance of DataService
func (*DataService) GetCampaignCriterionBidLandscape ¶
func (s *DataService) GetCampaignCriterionBidLandscape(selector Selector) ([]CriterionBidLandscape, int64, error)
GetCampaignCriterionBidLandscape returns CriterionBidLandscape
func (*DataService) GetCriterionBidLandscape ¶
func (s *DataService) GetCriterionBidLandscape(selector Selector) ([]CriterionBidLandscape, int64, error)
GetCriterionBidLandscape returns CriterionBidLandscape
type Date ¶
Date is a google date, a simple type inference with methods
func (Date) MarshalXML ¶
String gives the google representation of a date
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 Dimensions ¶
type DownloadFormat ¶
type DownloadFormat string
DownloadFormat is the return type of the reports that you want to fetch
func (DownloadFormat) Valid ¶
func (d DownloadFormat) Valid() error
Valid returns an error if the type is not a part of the allowed DownloadFormat values
type DynamicSearchAd ¶
type DynamicSearchAd struct { CommonAd Description1 string `xml:"description1"` Description2 string `xml:"description2"` }
DynamicSearchAd represents the equivalent object documented here https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.DynamicSearchAd
func (DynamicSearchAd) CloneForTemplate ¶
func (c DynamicSearchAd) CloneForTemplate(finalURLs []string, trackingURLTemplate *string) Ad
CloneForTemplate create a clone of an Ad, to recreate it for changing the tracking Url Template
type ErrorsType ¶
type ErrorsType struct {
ApiExceptionFaults []ApiExceptionFault `xml:"ApiExceptionFault"`
}
func (ErrorsType) Error ¶
func (f ErrorsType) Error() string
type ExpandedTextAd ¶
type ExpandedTextAd struct { CommonAd HeadlinePart1 string `xml:"headlinePart1"` HeadlinePart2 string `xml:"headlinePart2"` Description string `xml:"description"` Path1 string `xml:"path1"` Path2 string `xml:"path2"` }
ExpandedTextAd epresents the equivalent object documented here https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.ExpandedTextAd
func (ExpandedTextAd) CloneForTemplate ¶
func (c ExpandedTextAd) CloneForTemplate(finalURLs []string, trackingURLTemplate *string) Ad
CloneForTemplate create a clone of an Ad, to recreate it for changing the tracking Url Template
type ExperimentService ¶
type ExperimentService struct {
Auth
}
func NewExperimentService ¶
func NewExperimentService(auth *Auth) *ExperimentService
type ExtensionFeedItem ¶
ExtensionFeedItem is an interface all extension feed item implements
type ExtensionFeedItems ¶
type ExtensionFeedItems []ExtensionFeedItem
func (*ExtensionFeedItems) UnmarshalXML ¶
func (ex *ExtensionFeedItems) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
type ExtensionSetting ¶
type ExtensionSetting struct { Extensions ExtensionFeedItems `xml:"extensions"` PlateformRestrictions string `xml:"platformRestrictions"` }
ExtensionSetting specifies when and which extensions should serve at a given level (customer, campaign, or ad group).
type Fault ¶
type Fault struct { XMLName xml.Name `xml:"Fault"` FaultCode string `xml:"faultcode"` FaultString string `xml:"faultstring"` Errors ErrorsType `xml:"detail"` }
type FeedItemAttributeValue ¶
type FeedItemAttributeValue struct { AttributeID int64 `xml:"feedAttributeId"` IntegerValue *int64 `xml:"integerValue,omitempty"` DoubleValue *float64 `xml:"doubleValue,omitempty"` BooleanValue *bool `xml:"booleanValue,omitempty"` StringValue *string `xml:"stringValue,omitempty"` IntegerValues *[]int64 `xml:"integerValues,omitempty"` DoubleValues *[]float64 `xml:"doubleValues,omitempty"` BooleanValues *[]bool `xml:"booleanValues,omitempty"` StringValues *[]string `xml:"stringValues,omitempty"` }
func NewSitelinkFeedItemAttributeFinalMobileURLs ¶
func NewSitelinkFeedItemAttributeFinalMobileURLs(value []string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeFinalURLs ¶
func NewSitelinkFeedItemAttributeFinalURLs(value []string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeLine1 ¶
func NewSitelinkFeedItemAttributeLine1(value string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeLine2 ¶
func NewSitelinkFeedItemAttributeLine2(value string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeText ¶
func NewSitelinkFeedItemAttributeText(value string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeTrackingURL ¶
func NewSitelinkFeedItemAttributeTrackingURL(value string) FeedItemAttributeValue
func NewSitelinkFeedItemAttributeURL ¶
func NewSitelinkFeedItemAttributeURL(value string) FeedItemAttributeValue
type FeedItemOperations ¶
type FeedItemService ¶
type FeedItemService struct {
Auth
}
func NewFeedItemService ¶
func NewFeedItemService(auth *Auth) *FeedItemService
func (*FeedItemService) Get ¶
func (s *FeedItemService) Get(selector Selector) (feedItems []FeedItem, totalCount int64, err error)
func (*FeedItemService) Mutate ¶
func (s *FeedItemService) Mutate(feedItemOperations FeedItemOperations) (feedItems []FeedItem, err error)
type FeedMappingService ¶
type FeedMappingService struct {
Auth
}
func NewFeedMappingService ¶
func NewFeedMappingService(auth *Auth) *FeedMappingService
type FeedService ¶
type FeedService struct {
Auth
}
func NewFeedService ¶
func NewFeedService(auth *Auth) *FeedService
type FrequencyCap ¶
type GenderCriterion ¶
type GenderCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` GenderType string `xml:"genderType"` // GenderType: "GENDER_MALE", "GENDER_FEMALE", "GENDER_UNDETERMINED" }
func (GenderCriterion) GetID ¶
func (c GenderCriterion) GetID() int64
func (GenderCriterion) GetType ¶
func (c GenderCriterion) GetType() string
type GeoLocationService ¶
type GeoLocationService struct {
Auth
}
func NewGeoLocationService ¶
func NewGeoLocationService(auth *Auth) *GeoLocationService
type HasXSIType ¶
type HasXSIType interface {
GetType() string
}
type ImageAd ¶
type ImageAd struct { CommonAd Image int64 `xml:"imageId"` //TODO should actually be Image object, not just an int Name string `xml:"name"` AdToCopyImageFrom int64 `xml:"adToCopyImageFrom"` }
ImageAd represents the equivalent object documented here https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.ImageAd
func (ImageAd) CloneForTemplate ¶
CloneForTemplate create a clone of an Ad, to recreate it for changing the tracking Url Template
func (ImageAd) MarshalXML ¶
MarshalXML returns unimplemented error as the structure does not match yet 100% of the field required by google api
type KeywordCriterion ¶
type KeywordCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Text string `xml:"text,omitempty"` // Text: up to 80 characters and ten words MatchType string `xml:"matchType,omitempty"` // MatchType: "EXACT", "PHRASE", "BROAD" }
func (KeywordCriterion) GetID ¶
func (c KeywordCriterion) GetID() int64
func (KeywordCriterion) GetType ¶
func (c KeywordCriterion) GetType() string
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"` Status string `xml:"status,omitempty"` }
Label represents a label.
func NewTextLabel ¶
NewTextLabel returns an new Label struct for creating a new TextLabel.
type LabelOperations ¶
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
type LandscapePoint ¶
type LandscapePoint struct { Bid uint64 `xml:"bid>microAmount"` Clicks uint64 `xml:"clicks"` Cost uint64 `xml:"cost>microAmount"` Impressions uint64 `xml:"impressions"` PromotedImpressions uint64 `xml:"promotedImpressions"` RequiredBudget uint64 `xml:"requiredBudget>microAmount"` BidModifier float64 `xml:"bidModifier"` TotalImpressions uint64 `xml:"totalLocalImpressions"` TotalLocalClicks uint64 `xml:"totalLocalClicks"` TotalLocalCost uint64 `xml:"totalLocalCost>microAmount"` TotalLocalPromotedImpressions uint64 `xml:"totalLocalPromotedImpressions"` }
LandscapePoint struct for LandscapePoint
type LanguageCriterion ¶
type LanguageCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Code string `xml:"code,omitempty"` Name string `xml:"name,omitempty"` }
func (LanguageCriterion) GetID ¶
func (c LanguageCriterion) GetID() int64
func (LanguageCriterion) GetType ¶
func (c LanguageCriterion) GetType() string
type LinkStatus ¶
type LinkStatus string
LinkStatus represents the state of the link
const ( LinkStatusActive LinkStatus = "ACTIVE" LinkStatusInactive LinkStatus = "INACTIVE" LinkStatusPending LinkStatus = "PENDING" LinkStatusRefused LinkStatus = "REFUSED" LinkStatusCancelled LinkStatus = "CANCELLED" LinkStatusUnkwown LinkStatus = "UNKNOWN" )
type Location ¶
type Location struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` LocationName string `xml:"locationName,omitempty"` DisplayType string `xml:"displayType,omitempty"` TargetingStatus string `xml:"targetingStatus,omitempty"` ParentLocations []Location `xml:"parentLocations,omitempty"` }
LocationName: DisplayType: TargetingStatus: ACTIVE, OBSOLETE, PHASING_OUT ParentLocations:
type LocationCriterion ¶
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 ManagedCustomer ¶
type ManagedCustomer struct { Name string `xml:"name,omitempty"` CustomerID uint `xml:"customerId,omitempty"` CanManageClients bool `xml:"canManageClients,omitempty"` CurrencyCode string `xml:"currencyCode,omitempty"` TestAccount bool `xml:"testAccount,omitempty"` DateTimeZone string `xml:"dateTimeZone,omitempty"` ExcludeHiddenAccount bool `xml:"excludeHiddenAccounts,omitempty"` }
ManagedCustomer represents the accounts handled by the current clientCustomerID https://developers.google.com/adwords/api/docs/reference/v201809/ManagedCustomerService.ManagedCustomer
type ManagedCustomerLink ¶
type ManagedCustomerLink struct { ManagerCustomerID uint `xml:"managerCustomerId,omitempty"` ClientCustomerId uint `xml:"clientCustomerId,omitempty"` LinkStatus string `xml:"linkStatus,omitempty"` PendingDescriptiveName string `xml:"pendingDescriptiveName,omitempty"` Hidden bool `xml:"isHidden,omitempty"` }
ManagedCustomerLink represents the status of the link between the current account and the account it manages https://developers.google.com/adwords/api/docs/reference/v201809/ManagedCustomerService.ManagedCustomerLink
type ManagedCustomerLinkOperations ¶
type ManagedCustomerLinkOperations map[string][]*ManagedCustomerLink
ManagedCustomerLinkOperations are used when you change links between mcc and classic adwords account
type ManagedCustomerLinkResult ¶
type ManagedCustomerLinkResult struct {
Links []*ManagedCustomerLink `xml:"links,omitempty"`
}
ManagedCustomerLinkResult is the response of the MutateLink service @see https://developers.google.com/adwords/api/docs/reference/v201809/ManagedCustomerService.MutateLinkResults
type ManagedCustomerMoveOperation ¶
type ManagedCustomerMoveOperation struct { OldManagerCustomerId uint Link ManagedCustomerLink }
ManagedCustomerMoveOperation is one operation in the move actions
type ManagedCustomerMoveOperations ¶
type ManagedCustomerMoveOperations map[string][]ManagedCustomerMoveOperation
ManagedCustomerMoveOperations are performed when you move an account inside the hierarchy
type ManagedCustomerService ¶
type ManagedCustomerService struct {
Auth
}
ManagedCustomerService represents the api that handle links between accounts
func NewManagedCustomerService ¶
func NewManagedCustomerService(auth *Auth) *ManagedCustomerService
NewManagedCustomerService is the ManagedCustomerService constructor
func (*ManagedCustomerService) Get ¶
func (m *ManagedCustomerService) Get(selector Selector) ( customers []ManagedCustomer, managedCustomerLinks []ManagedCustomerLink, totalCount int64, err error, )
Get fetches the managed customers of the current account
func (*ManagedCustomerService) MutateLink ¶
func (m *ManagedCustomerService) MutateLink(mcl ManagedCustomerLinkOperations) ([]*ManagedCustomerLink, error)
MutateLink changes the links between mcc and classic adwords account
func (*ManagedCustomerService) MutateManager ¶
func (m *ManagedCustomerService) MutateManager(mcmOps ManagedCustomerMoveOperations) (links []ManagedCustomerLink, err error)
MutateManager takes a budgetOperations and creates, modifies or destroys the associated budgets.
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"` MimeType string `xml:"mimeType,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.
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 MobileAppCategoryCriterion ¶
type MobileAppCategoryCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` 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:
func (MobileAppCategoryCriterion) GetID ¶
func (c MobileAppCategoryCriterion) GetID() int64
func (MobileAppCategoryCriterion) GetType ¶
func (c MobileAppCategoryCriterion) GetType() string
type MobileApplicationCriterion ¶
type MobileApplicationCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` AppId string `xml:"appId"` DisplayName string `xml:"displayName,omitempty"` }
AppId: "{platform}-{platform_native_id}" DisplayName:
func (MobileApplicationCriterion) GetID ¶
func (c MobileApplicationCriterion) GetID() int64
func (MobileApplicationCriterion) GetType ¶
func (c MobileApplicationCriterion) GetType() string
type MobileDeviceCriterion ¶
type MobileDeviceCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` 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:
func (MobileDeviceCriterion) GetID ¶
func (c MobileDeviceCriterion) GetID() int64
func (MobileDeviceCriterion) GetType ¶
func (c MobileDeviceCriterion) GetType() string
type MutateJobService ¶
type MutateJobService struct {
Auth
}
func NewMutateJobService ¶
func NewMutateJobService(auth *Auth) *MutateJobService
type NegativeAdGroupCriterion ¶
type NegativeAdGroupCriterion struct { AdGroupId int64 `xml:"adGroupId"` 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 { Type string `xml:"xsi:type,attr,omitempty"` CampaignId int64 `xml:"campaignId"` IsNegative bool `xml:"isNegative"` 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
func (*NegativeCampaignCriterion) UnmarshalXML ¶
func (cc *NegativeCampaignCriterion) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
type NetworkSetting ¶
type NotEmptyError ¶
type NumberRuleItem ¶
type OfflineConversionService ¶
type OfflineConversionService struct {
Auth
}
func NewOfflineConversionService ¶
func NewOfflineConversionService(auth *Auth) *OfflineConversionService
type OperatingSystemVersionCriterion ¶
type OperatingSystemVersionCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` 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
func (OperatingSystemVersionCriterion) GetID ¶
func (c OperatingSystemVersionCriterion) GetID() int64
func (OperatingSystemVersionCriterion) GetType ¶
func (c OperatingSystemVersionCriterion) GetType() string
type OperationError ¶
type PartialFailureError ¶
type PartialFailureError struct { FieldPath string `xml:"fieldPath,omitempty"` Trigger string `xml:"trigger,omitempty"` Type string `xml:"type,attr,omitempty"` Reason string `xml:"reason,omitempty"` Code string `xml:"errorString,omitempty"` Offset *int `xml:"-"` }
PartialFailureError represents a
func (*PartialFailureError) Error ¶
func (p *PartialFailureError) Error() string
Error return a summary of the error
func (*PartialFailureError) GetRequestOffset ¶
func (p *PartialFailureError) GetRequestOffset() (int, error)
GetRequestOffset returns the offset of the current partial error
type PartialFailureErrors ¶
type PartialFailureErrors []*PartialFailureError
func (PartialFailureErrors) Error ¶
func (p PartialFailureErrors) Error() string
Error returns all the errors combined
type PlacementCriterion ¶
type PlacementCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Url string `xml:"url"` }
Url:
func (PlacementCriterion) GetID ¶
func (c PlacementCriterion) GetID() int64
func (PlacementCriterion) GetType ¶
func (c PlacementCriterion) GetType() string
type PlatformCriterion ¶
type PlatformCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` PlatformName string `xml:"platformName,omitempty"` }
PlatformId:
Desktop 30000 HighEndMobile 30001 Tablet 30002
func (PlatformCriterion) GetID ¶
func (c PlatformCriterion) GetID() int64
func (PlatformCriterion) GetType ¶
func (c PlatformCriterion) GetType() string
type ProductBiddingCategoryData ¶
type ProductBiddingCategoryData struct { Type string `xml:"type"` DimensionValue struct { Type string `xml:"type"` Values int64 `xml:"value"` } `xml:"dimensionValue"` ParentDimensionValue struct { Type string `xml:"type"` Values int64 `xml:"value"` } `xml:"parentDimensionValue"` Country string `xml:"country"` Status string `xml:"status"` DisplayValue struct { Key string `xml:"key"` Value string `xml:"value"` } `xml:"displayValue"` }
type ProductCondition ¶
Argument: Operand: id, product_type, brand, adwords_grouping, condition, adwords_labels
type ProductCriterion ¶
type ProductCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Conditions []ProductCondition `xml:"conditions,omitempty"` Text string `xml:"text,omitempty"` }
func (ProductCriterion) GetID ¶
func (c ProductCriterion) GetID() int64
func (ProductCriterion) GetType ¶
func (c ProductCriterion) GetType() string
type ProductDimension ¶
type ProductDimension struct { Type string `xml:"xsi:type,attr,omitempty"` CategoryType string `xml:"type,omitempty"` Value string `xml:"value,omitempty"` }
func NewProductOfferId ¶
func NewProductOfferId(value string) *ProductDimension
func (ProductDimension) GetType ¶
func (c ProductDimension) GetType() string
func (*ProductDimension) UnmarshalXML ¶
func (pd *ProductDimension) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML special case of unmarshall to manage xsi:type work on Marshal not in Unmarshal
type ProductPartitionCriterion ¶
type ProductPartitionCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` PartitionType *string `xml:"partitionType,omitempty"` ParentCriterionId *int64 `xml:"parentCriterionId,omitempty"` CaseValue *ProductDimension `xml:"caseValue,omitempty"` }
func (ProductPartitionCriterion) GetID ¶
func (c ProductPartitionCriterion) GetID() int64
GetID returns the current identifier of the criterion
func (ProductPartitionCriterion) GetType ¶
func (c ProductPartitionCriterion) GetType() string
type ProximityCriterion ¶
type ProximityCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` 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:
func (ProximityCriterion) GetID ¶
func (c ProximityCriterion) GetID() int64
func (ProximityCriterion) GetType ¶
func (c ProximityCriterion) GetType() string
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 ReportDefinition ¶
type ReportDefinition struct { XMLName xml.Name `xml:"reportDefinition"` ID string `xml:"id,omitempty"` ClientCustomerID string `xml:"-"` Selector Selector `xml:"selector"` ReportName string `xml:"reportName"` ReportType string `xml:"reportType"` HasAttachment string `xml:"hasAttachment,omitempty"` DateRangeType DateRangeType `xml:"dateRangeType"` CreationTime string `xml:"creationTime,omitempty"` DownloadFormat DownloadFormat `xml:"downloadFormat"` IncludeZeroImpressions bool `xml:"-"` SkipHeader bool `xml:"-"` SkipSummary bool `xml:"-"` }
ReportDefinition represents a request for the report API https://developers.google.com/adwords/api/docs/guides/reporting
func (*ReportDefinition) ValidRequest ¶
func (r *ReportDefinition) ValidRequest() error
ValidRequest returns an error if the report can't be used to do request to the api
type ReportDefinitionService ¶
type ReportDefinitionService struct {
Auth
}
ReportDefinitionService is the service you call when you want to access reports
func NewReportDefinitionService ¶
func NewReportDefinitionService(auth *Auth) *ReportDefinitionService
NewReportDefinitionService creates a ReportDefinitionService that can be accessed with Auth object
func (*ReportDefinitionService) Request ¶
func (r *ReportDefinitionService) Request(def *ReportDefinition) (body io.ReadCloser, err error)
Request launch a request to the reporting api with the definition of the wanted report We return a reader because the response format depends of the ReportDefinition.DownloadFormat field
type Rule ¶
type Rule struct {
Groups []RuleItemGroup `xml:"groups"`
}
type RuleItemGroup ¶
type RuleItemGroup struct {
Items []interface{} `xml:"items"`
}
type ServiceLink ¶
type ServiceLink struct { Type string `xml:"serviceType,omitempty"` ID int64 `xml:"serviceLinkId,omitempty"` Status string `xml:"linkStatus,omitempty"` Name string `xml:"name,omitempty"` }
ServiceLink struct for customer service link
type ServiceLinkOperations ¶
type ServiceLinkOperations map[string][]ServiceLink
type ServiceUrl ¶
func (ServiceUrl) String ¶
func (s ServiceUrl) String() string
type SharedBiddingStrategy ¶
type SharedBiddingStrategy struct {}
SharedBiddingStrategy struct of entity for BiddingStrategyService
func (*SharedBiddingStrategy) UnmarshalXML ¶
func (b *SharedBiddingStrategy) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML special unmarshal for the different bidding schemes
type SharedCriterionService ¶
type SharedCriterionService struct {
}func NewSharedCriterionService ¶
func NewSharedCriterionService(auth *Auth) *SharedCriterionService
type SharedSetService ¶
type SharedSetService struct {
}func NewSharedSetService ¶
func NewSharedSetService(auth *Auth) *SharedSetService
type SitelinkFeedItem ¶
type SitelinkFeedItem struct { *CommonExtensionFeedItem Text string `xml:"sitelinkText"` URL *string `xml:"sitelinkUrl"` Line2 *string `xml:"sitelinkLine2"` Line3 *string `xml:"sitelinkLine3"` FinalUrls *UrlList `xml:"sitelinkFinalUrls"` TrackingURLTemplate *string `xml:"sitelinkTrackingUrlTemplate"` }
SitelinkFeedItem represents a sitelink extension.
type StringRuleItem ¶
type TargetError ¶
type TargetIdeaService ¶
type TargetIdeaService struct {
Auth
}
func NewTargetIdeaService ¶
func NewTargetIdeaService(auth *Auth) *TargetIdeaService
type TargetRoasBiddingScheme ¶
type TargetRoasBiddingScheme struct { Type string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"` TargetRoas float64 `xml:"targetRoas"` BidCeiling *int64 `xml:"bidCeiling>microAmount"` BidFloor *int64 `xml:"bidFloor>microAmount"` }
TargetRoasBiddingScheme struct for TargetRoasBiddingScheme
func NewTargetRoasBiddingScheme ¶
func NewTargetRoasBiddingScheme(targetRoas float64, bidCeiling, bidFloor *int64) *TargetRoasBiddingScheme
NewTargetRoasBiddingScheme returns new instance of TargetRoasBiddingScheme
func (*TargetRoasBiddingScheme) GetType ¶
func (s *TargetRoasBiddingScheme) GetType() string
GetType return type of bidding scheme
type TargetSettingDetail ¶
type TargetSettingDetail struct { CriterionTypeGroup string `xml:"criterionTypeGroup"` TargetAll bool `xml:"targetAll"` }
func NewTargetSettingDetail ¶
func NewTargetSettingDetail(CriterionTypeGroup string, TargetAll bool) TargetSettingDetail
type TemplateAd ¶
type TemplateAd struct { CommonAd 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"` // contains filtered or unexported fields }
TemplateAd represents the equivalent object documented here https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.TemplateAd
func (TemplateAd) CloneForTemplate ¶
func (c TemplateAd) CloneForTemplate(finalURLs []string, trackingURLTemplate *string) Ad
CloneForTemplate create a clone of an Ad, to recreate it for changing the tracking Url Template
func (TemplateAd) MarshalXML ¶
func (c TemplateAd) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML returns unimplemented error as the structure does not match yet 100% of the field required by google api
type TemplateElement ¶
type TemplateElement struct { UniqueName string `xml:"uniqueName"` Fields []TemplateElementField `xml:"fields"` }
type TemplateElementField ¶
type TextAd ¶
type TextAd struct { CommonAd Headline string `xml:"headline"` Description1 string `xml:"description1"` Description2 string `xml:"description2"` }
TextAd represents the TextAd object as documented here https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.TextAd
type TrafficEstimatorService ¶
type TrafficEstimatorService struct {
Auth
}
func NewTrafficEstimatorService ¶
func NewTrafficEstimatorService(auth *Auth) *TrafficEstimatorService
type UnknownError ¶
type UserInterestCriterion ¶
type UserInterestCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"userInterestId,omitempty"` Name string `xml:"userInterestName"` }
func (UserInterestCriterion) GetID ¶
func (c UserInterestCriterion) GetID() int64
func (UserInterestCriterion) GetType ¶
func (c UserInterestCriterion) GetType() string
type UserList ¶
type UserList struct { Id int64 `xml:"id,omitempty"` Type string `xml:"xsi:type,attr"` Readonly *bool `xml:"isReadOnly,omitempty"` Name string `xml:"name"` Description string `xml:"description,omitempty"` Status string `xml:"status"` // membership status "OPEN", "CLOSED" IntegrationCode string `xml:"integrationCode,omitempty"` AccessReason string `xml:"accessReason,omitempty"` // account access resson "OWNER", "SHARED", "LICENSED", "SUBSCRIBED" AccountUserListStatus string `xml:"accountUserListStatus,omitempty"` // 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"` }
func NewBasicUserList ¶
func NewBasicUserList(name, description, status, integrationCode string, membershipLifeSpan int64, conversionTypes []UserListConversionType) (adwordsUserList UserList)
func NewLogicalUserList ¶
func NewLogicalUserList(name, description, status, integrationCode string, membershipLifeSpan int64, logicalRules []UserListLogicalRule) (adwordsUserList UserList)
func NewSimilarUserList ¶
type UserListConversionType ¶
type UserListCriterion ¶
type UserListCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` UserListId int64 `xml:"userListId"` UserListName string `xml:"userListName,omitempty"` UserListMembershipStatus string `xml:"userListMembershipStatus,omitempty"` }
func (UserListCriterion) GetID ¶
func (c UserListCriterion) GetID() int64
func (UserListCriterion) GetType ¶
func (c UserListCriterion) GetType() string
type UserListLogicalRule ¶
type UserListOperations ¶
type VerticalCriterion ¶
type VerticalCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"verticalId,omitempty"` ParentId int64 `xml:"verticalParentId"` Path []string `xml:"path"` }
func (VerticalCriterion) GetID ¶
func (c VerticalCriterion) GetID() int64
func (VerticalCriterion) GetType ¶
func (c VerticalCriterion) GetType() string
type WebpageCondition ¶
type WebpageCriterion ¶
type WebpageCriterion struct { Type string `xml:"xsi:type,attr,omitempty"` Id int64 `xml:"id,omitempty"` Parameter WebpageParameter `xml:"parameter"` CriteriaCoverage float64 `xml:"criteriaCoverage"` CriteriaSamples []string `xml:"criteriaSamples"` }
func (WebpageCriterion) GetID ¶
func (c WebpageCriterion) GetID() int64
func (WebpageCriterion) GetType ¶
func (c WebpageCriterion) GetType() string
type WebpageParameter ¶
type WebpageParameter struct { CriterionName string `xml:"criterionName"` Conditions []WebpageCondition `xml:"conditions"` }
Source Files ¶
- ad.go
- ad_group.go
- ad_group_ad.go
- ad_group_ads.go
- ad_group_bid_modifier.go
- ad_group_criterion.go
- ad_group_feed.go
- ad_param.go
- adwords_user_list.go
- awql.go
- base.go
- biddable_ad_group_criterion.go
- bidding_strategy.go
- budget.go
- budget_order.go
- campaign.go
- campaign_ad_extension.go
- campaign_criterion.go
- campaign_extension_setting.go
- campaign_feed.go
- campaign_shared_set.go
- constant_data.go
- conversion_tracker.go
- criterion.go
- customer.go
- customer_feed.go
- customer_sync.go
- data.go
- doc.go
- error_partial.go
- errors.go
- experiment.go
- extension_feed_item.go
- feed.go
- feed_item.go
- feed_mapping.go
- geo_location.go
- label.go
- location_criterion.go
- managed_customer.go
- media.go
- mutate_job.go
- negative_ad_group_criterion.go
- oauth2.go
- offline_conversion_feed.go
- report_definition.go
- response.go
- shared_criterion.go
- shared_set.go
- targeting_idea.go
- traffic_estimator.go
- urls.go
- xml.go
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. |