line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2011, Google Inc. All Rights Reserved. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
|
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
|
|
|
|
# limitations under the License. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Module to store package-level constants and default values. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Google::Ads::AdWords::Constants; |
18
|
|
|
|
|
|
|
|
19
|
14
|
|
|
14
|
|
1126
|
use strict; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
371
|
|
20
|
14
|
|
|
14
|
|
64
|
use warnings; |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
355
|
|
21
|
14
|
|
|
14
|
|
71
|
use version; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
63
|
|
22
|
|
|
|
|
|
|
|
23
|
14
|
|
|
14
|
|
4924
|
use File::HomeDir; |
|
14
|
|
|
|
|
57549
|
|
|
14
|
|
|
|
|
983
|
|
24
|
14
|
|
|
14
|
|
3534
|
use File::Spec::Functions; |
|
14
|
|
|
|
|
9580
|
|
|
14
|
|
|
|
|
1590
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Main version number that the rest of the modules pick up off of. |
27
|
|
|
|
|
|
|
our $VERSION = qv("4.18.0"); |
28
|
|
|
|
|
|
|
|
29
|
14
|
|
|
|
|
107
|
use constant DEFAULT_PROPERTIES_FILE => |
30
|
14
|
|
|
14
|
|
105
|
catfile(File::HomeDir->my_home, "adwords.properties"); |
|
14
|
|
|
|
|
30
|
|
31
|
14
|
|
|
14
|
|
1664
|
use constant DEFAULT_USER_AGENT => "unknown"; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
682
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# In this format string, the first %s is the URL prefix, the second is the |
34
|
|
|
|
|
|
|
# version, and the third is service name. |
35
|
14
|
|
|
14
|
|
75
|
use constant PROXY_FORMAT_STRING => "%s/api/adwords/%s/%s/%s"; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
719
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Default current version used if the client is created without the version |
38
|
|
|
|
|
|
|
# parameter. |
39
|
14
|
|
|
14
|
|
88
|
use constant DEFAULT_VERSION => "v201708"; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
649
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Default alternate URL that points to production servers. |
42
|
14
|
|
|
14
|
|
73
|
use constant DEFAULT_ALTERNATE_URL => "https://adwords.google.com"; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
661
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Default validation header value passed to the servers. |
45
|
14
|
|
|
14
|
|
93
|
use constant DEFAULT_VALIDATE_ONLY => "false"; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
745
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Default OAuth scope for AdWords |
48
|
14
|
|
|
14
|
|
80
|
use constant DEFAULT_OAUTH_SCOPE => "https://www.googleapis.com/auth/adwords"; |
|
14
|
|
|
|
|
30
|
|
|
14
|
|
|
|
|
741
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Maximum number of request stats to keep in memory, any overflow will result |
51
|
|
|
|
|
|
|
# on droppping older requests stats out of memory. |
52
|
14
|
|
|
14
|
|
80
|
use constant MAX_NUM_OF_REQUEST_STATS => 500; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
2149
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Mapping of services to namespace group, required to figure out the service |
55
|
|
|
|
|
|
|
# url endpoints. |
56
|
|
|
|
|
|
|
our %SERVICE_TO_GROUP = ( |
57
|
|
|
|
|
|
|
AccountLabelService => "mcm", |
58
|
|
|
|
|
|
|
AdCustomizerFeedService => "cm", |
59
|
|
|
|
|
|
|
AdGroupAdService => "cm", |
60
|
|
|
|
|
|
|
AdGroupBidModifierService => "cm", |
61
|
|
|
|
|
|
|
AdGroupCriterionService => "cm", |
62
|
|
|
|
|
|
|
AdGroupExtensionSettingService => "cm", |
63
|
|
|
|
|
|
|
AdGroupFeedService => "cm", |
64
|
|
|
|
|
|
|
AdGroupService => "cm", |
65
|
|
|
|
|
|
|
AdParamService => "cm", |
66
|
|
|
|
|
|
|
AdwordsUserListService => "rm", |
67
|
|
|
|
|
|
|
AlertService => "mcm", |
68
|
|
|
|
|
|
|
BatchJobService => 'cm', |
69
|
|
|
|
|
|
|
BiddingStrategyService => "cm", |
70
|
|
|
|
|
|
|
BudgetOrderService => "billing", |
71
|
|
|
|
|
|
|
BudgetService => "cm", |
72
|
|
|
|
|
|
|
CampaignAdExtensionService => "cm", |
73
|
|
|
|
|
|
|
CampaignBidModifierService => "cm", |
74
|
|
|
|
|
|
|
CampaignCriterionService => "cm", |
75
|
|
|
|
|
|
|
CampaignExtensionSettingService => "cm", |
76
|
|
|
|
|
|
|
CampaignFeedService => "cm", |
77
|
|
|
|
|
|
|
CampaignGroupService => "cm", |
78
|
|
|
|
|
|
|
CampaignGroupPerformanceTargetService => "cm", |
79
|
|
|
|
|
|
|
CampaignService => "cm", |
80
|
|
|
|
|
|
|
CampaignSharedSetService => "cm", |
81
|
|
|
|
|
|
|
ConstantDataService => "cm", |
82
|
|
|
|
|
|
|
ConversionTrackerService => "cm", |
83
|
|
|
|
|
|
|
CustomerService => "mcm", |
84
|
|
|
|
|
|
|
CustomerExtensionSettingService => "cm", |
85
|
|
|
|
|
|
|
CustomerFeedService => "cm", |
86
|
|
|
|
|
|
|
CustomerSyncService => "ch", |
87
|
|
|
|
|
|
|
CustomerNegativeCriterionService => "cm", |
88
|
|
|
|
|
|
|
DataService => "cm", |
89
|
|
|
|
|
|
|
DraftAsyncErrorService => "cm", |
90
|
|
|
|
|
|
|
DraftService => "cm", |
91
|
|
|
|
|
|
|
ExperimentService => "cm", |
92
|
|
|
|
|
|
|
FeedItemService => "cm", |
93
|
|
|
|
|
|
|
FeedMappingService => "cm", |
94
|
|
|
|
|
|
|
FeedService => "cm", |
95
|
|
|
|
|
|
|
GeoLocationService => "cm", |
96
|
|
|
|
|
|
|
LabelService => "cm", |
97
|
|
|
|
|
|
|
LocationCriterionService => "cm", |
98
|
|
|
|
|
|
|
ManagedCustomerService => "mcm", |
99
|
|
|
|
|
|
|
MediaService => "cm", |
100
|
|
|
|
|
|
|
OfflineCallConversionFeedService => "cm", |
101
|
|
|
|
|
|
|
OfflineConversionFeedService => "cm", |
102
|
|
|
|
|
|
|
OfflineDataUploadService => "rm", |
103
|
|
|
|
|
|
|
ReportDefinitionService => "cm", |
104
|
|
|
|
|
|
|
SharedCriterionService => "cm", |
105
|
|
|
|
|
|
|
SharedSetService => "cm", |
106
|
|
|
|
|
|
|
TargetingIdeaService => "o", |
107
|
|
|
|
|
|
|
TrafficEstimatorService => "o", |
108
|
|
|
|
|
|
|
TrialAsyncErrorService => "cm", |
109
|
|
|
|
|
|
|
TrialService => "cm" |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Useful constant to translate micros to dollars and viceversa. |
113
|
14
|
|
|
14
|
|
114
|
use constant MICROS_PER_DOLLAR => 1000000; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
690
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
########## Reporting Utilities ########## |
116
|
|
|
|
|
|
|
|
117
|
14
|
|
|
14
|
|
78
|
use constant ADHOC_REPORT_DOWNLOAD_URL => "%s/api/adwords/reportdownload/%s"; |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
661
|
|
118
|
14
|
|
|
14
|
|
79
|
use constant LWP_DEFAULT_TIMEOUT => 300; # 5 minutes. |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
669
|
|
119
|
14
|
|
|
14
|
|
76
|
use constant REPORT_SCRUBBED_HEADERS => qw(DeveloperToken Authorization); |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
754
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
########## Paging Utilities ########## |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# A default number of entries to be retrieved per page. |
124
|
14
|
|
|
14
|
|
77
|
use constant DEFAULT_PAGE_SIZE => 100; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
954
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# Regular expression representing the LIMIT portion of an AWQL query. |
127
|
|
|
|
|
|
|
# Group 1 => The SELECT clause before LIMIT |
128
|
|
|
|
|
|
|
# Group 2 => Offset defined by LIMIT |
129
|
|
|
|
|
|
|
# Group 3 => Page Size defined by LIMIT |
130
|
|
|
|
|
|
|
# Example: LIMIT 1,3 |
131
|
14
|
|
|
14
|
|
82
|
use constant QUERY_LIMIT_REGEX => qr/(.*)LIMIT\s+(\d+)\s*,\s*(\d+).*/; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
781
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
return 1; |