get reports from different accounts

176 views
Skip to first unread message

uatet...@gmail.com

unread,
Mar 26, 2019, 4:59:30 PM3/26/19
to AdWords API and Google Ads API Forum
Hi!
We want to get reports from Google Adwords by API. Get reports from account of our clients save this data and build special reports for clients for understand (show) efectivity ads.
Please, help me to understand how it have to work.
If I right understand:
1. i have to register manage account in google adwords
2. for testing I have to register test account
3. then connect my test account to non-test account (how i can do it by API?)

googleadsapi...@google.com

unread,
Mar 27, 2019, 3:42:08 AM3/27/19
to AdWords API and Google Ads API Forum
Hi,

Thank you for reaching out. If you want to use the Google Ads API to generate reports, first you have to apply for a developer token if you don't already have one by following this guide. Then, you should download a client library, set up OAuth2 credentials by following this guide and get your refresh token by following this guide

Once your setup has been completed, you may then make your first API call using your test account. You may check this guide for more information about the access level.

Also, you should take note that test accounts can't be associated to a production account. If you want to make an API call to a production account, you should apply for basic access. The Compliance Team will contact you within 2 business days for its status. Once access has been approved, you may then make an API call to your production Google Account.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/30349bb9-f34e-42d2-a65f-9b9792e4ccea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

uatet...@gmail.com

unread,
Mar 27, 2019, 9:26:31 AM3/27/19
to AdWords API and Google Ads API Forum
  Thank you for the answer.
I have 2 questions.
You give me a link to google ads but I already installed google adwords (installed library and get refresh_token). [1] Can I do all by google adwords library?
I already tried the first API call but have the answer: "[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @; trigger: '<null>'] '. I used the developer token with Access level - Test Account.
So, now I'm writing to apply developer token, but do not understand [2] what I have to write in documentation in part API Services Called.

середа, 27 березня 2019 р. 09:42:08 UTC+2 користувач googleadsapi-forumadvisor написав:

googleadsapi...@google.com

unread,
Mar 27, 2019, 9:47:36 PM3/27/19
to AdWords API and Google Ads API Forum
Hi,

Apologies for the confusion. In AdWords API, the DEVELOPER_TOKEN_NOT_APPROVED occurs when you try to use an unapproved developer token to make calls in a production account. Take note that an unapproved developer token can only make calls against a test Google Ads account. To be able to make calls using your production account, you should apply for basic access as shown in this guide. The compliance team will then contact you within 2 business days to update you on the status. Once the access has been approved, you may then try to make an API call using your production account.

Let me know if you have any further concerns.



Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

uatet...@gmail.com

unread,
Mar 28, 2019, 5:10:45 PM3/28/19
to AdWords API and Google Ads API Forum
Hi.
Please, help me to understand.
1. I had to register my aplication in console.developers.google.com
2. I got client_id and client_secret
3. using GetRefreshToken.php I got the link
4. went to link
5. applied permission
6. got code
7. with code I got a refresh_token
8. I written data to adsapi_php.ini

each of my clients will go to my link, apply permission, I will get refresh_token for each of my client, save refresh_token.
question: all data (like: client_id, client_secret, developerToken, clientCustomerId) have to be permanent but refresh_token have to be different to each of my client for each getting data from google adwords by api?

четвер, 28 березня 2019 р. 03:47:36 UTC+2 користувач googleadsapi-forumadvisor написав:

googleadsapi...@google.com

unread,
Mar 29, 2019, 3:07:18 AM3/29/19
to AdWords API and Google Ads API Forum
Hi,

I could see that you already generated a refresh token. Refresh token is only generated once and doesn't have to be different for each of your client accounts. If this does not answer your concern, feel free to write back.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

uatet...@gmail.com

unread,
Mar 29, 2019, 9:30:33 AM3/29/19
to AdWords API and Google Ads API Forum
Thank you. Okey, I'm understand that refresh_token we will generate once, but how to say Adwords by API call that in request #1 give me data of campaign from account 000-000-0000, in request #2 give me data of campaign from account 111-111-1111?

If I right understand process of linking accounts. Client want to link self adwords account with my MCC -> client click and redirect to google page where allow access -> then will redirect to redirect_url (my page) -> I will get "code" -> and then I  thought that I have to generate refresh_token save this refresh_token and in API call to account 000-000-0000 use his refresh_token but ... no


пʼятниця, 29 березня 2019 р. 10:07:18 UTC+3 користувач googleadsapi-forumadvisor написав:

googleadsapi...@google.com

unread,
Apr 1, 2019, 3:44:21 AM4/1/19
to AdWords API and Google Ads API Forum
Hi,

Could you confirm if the following accounts are in the same hierarchy with your production manager account? If it is not of the same hierarchy with the production manager account, the production manager account must be granted access first before you could use the OAuth2 credentials (created using an email address with access to the MCC) of the said MCC to retrieve data from these client accounts. To achieve this, you can invite the other account into your existing hierarchy and you may check this guide to know more about managing accounts.

Take note that in AdWords API you could only retrieve reports from a single client account for each API call. In this case, you would need to change the value of api.adwords.clientCustomerId from adsapi_php.ini every time you wish to retrieve data from another client. Say the current value of api.adwords.clientCustomerId is 000-000-0000 and you run the code GetCampaigns(), you should get all the campaigns from client 000-000-0000. Say you want to retrieve the campaigns from another client 111-111-1111, you need to change the value of api.adwords.clientCustomerId to 111-111-1111 before running the code again and you should get all the campaigns from that client.

Let me know if this helps.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

uatet...@gmail.com

unread,
Apr 8, 2019, 9:12:40 AM4/8/19
to AdWords API and Google Ads API Forum
Hi!
Thank you about clearly explanation.
 
I try to get report "PAID_ORGANIC_QUERY_REPORT"
class GetReportFields
{


   
const PAGE_LIMIT = 500;


   
public static function runExample(
       
AdWordsServices $adWordsServices,
       
AdWordsSession $session
   
) {
        $reportDefinitionService
= $adWordsServices->get($session, ReportDefinitionService::class);


       
// The type of the report to get fields for.
        $reportType
= ReportDefinitionReportType::PAID_ORGANIC_QUERY_REPORT;


       
// Get report fields of the report type.
        $reportDefinitionFields
= $reportDefinitionService->getReportFields($reportType);


        printf
(
           
"The report type '%s' contains the following fields:\n",
            $reportType
       
);
       
foreach ($reportDefinitionFields as $reportDefinitionField) {
            printf
(
               
'  %s (%s)',
                $reportDefinitionField
->getFieldName(),
                $reportDefinitionField
->getFieldType()
           
);
           
if ($reportDefinitionField->getEnumValues() !== null) {
                printf
(
                   
' := [%s]',
                    implode
(', ', $reportDefinitionField->getEnumValues())
               
);
           
}
           
print "\n";
       
}
   
}


   
public static function main()
   
{
       
// Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential
= (new OAuth2TokenBuilder())->fromFile()->build();


       
// Construct an API session configured from a properties file and the
       
// OAuth2 credentials above.
        $session
= (new AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($oAuth2Credential)->build();
       
self::runExample(new AdWordsServices(), $session);
   
}
}


GetReportFields::main();

But get only fields:

[2019-04-08 14:39:31] AW_SOAP.INFO: clientCustomerId=XXX-XXX-XXX operations=1 service=ReportDefinitionService method=getReportFields responseTime=170 requestId=XXXXXXXXXXXXXXXXXXXXX server=adwords.google.com isFault=0 faultMessage=
The report type 'PAID_ORGANIC_QUERY_REPORT' contains the following fields:
  KeywordId (long)
  AccountCurrencyCode (String)
  AccountDescriptiveName (String)
  AccountTimeZone (String)
  AdGroupId (Long)
  AdGroupName (String)
  AdGroupStatus (AdGroupStatus) := [UNKNOWN, ENABLED, PAUSED, REMOVED]
  AverageCpc (Money)
  AveragePosition (Double)
  CampaignId (Long)
  CampaignName (String)
  CampaignStatus (CampaignStatus) := [UNKNOWN, ENABLED, PAUSED, REMOVED]
  Clicks (Long)
  CombinedAdsOrganicClicks (Long)
  CombinedAdsOrganicClicksPerQuery (Double)
  CombinedAdsOrganicQueries (Long)
  Ctr (Double)
  CustomerDescriptiveName (String)
  Date (Date)
  DayOfWeek (DayOfWeek) := [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]
  ExternalCustomerId (Long)
  Impressions (Long)
  KeywordTextMatchingQuery (String)
  Month (String)
  MonthOfYear (MonthOfYear) := [JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER]
  OrganicAveragePosition (Double)
  OrganicClicks (Long)
  OrganicClicksPerQuery (Double)
  OrganicImpressions (Long)
  OrganicImpressionsPerQuery (Double)
  OrganicQueries (Long)
  Quarter (String)
  QueryMatchType (QueryMatchType) := [AUTO, BROAD, EXACT, EXPANDED, PHRASE]
  SearchQuery (String)
  SerpType (SerpType) := [UNKNOWN, ADS_ONLY, ORGANIC_ONLY, ADS_AND_ORGANIC]
  Week (String)
  Year (Integer)

I read this and thought that I will get full report. 


понеділок, 1 квітня 2019 р. 10:44:21 UTC+3 користувач googleadsapi-forumadvisor написав:

googleadsapi...@google.com

unread,
Apr 10, 2019, 2:26:00 AM4/10/19
to AdWords API and Google Ads API Forum
Hi,

To better assist you, could you further elaborate the issue that you are facing regarding the PAID_ORGANIC_QUERY_REPORT? Also, could you clarify what is the result you are expecting from the report?

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

uatet...@gmail.com

unread,
Apr 10, 2019, 4:16:10 PM4/10/19
to adwor...@googlegroups.com
Hi!
What I want to get from report - for example:
campaign   | source    | medium      | term      | clicks    | pay (cost)
test
1     | test_sour | test_med    | test_term | 50        | 160
test
1     | test_sour2| test_med2   | test_term2| 42        | 260
test
1     | test_sour3| test_med3   | test_term | 150       | 546

In this page I read: "The Paid and Organic Query report provides a holistic view of your search stats across ads and organic listings at the query level".
But instead report I have only headers
[2019-04-08 14:39:31] AW_SOAP.INFO: clientCustomerId=XXX-XXX-XXXX operations=1 service=ReportDefinitionService method=getReportFields responseTime=170 requestId=000586034a2991be0a374b877a05b23d server=adwords.google.com isFault=0 faultMessage=

Maybe paid_organic_query_report it isn't better solution for get campaign, source, medium, term, clicks, pay (cost), and you will recommend me something other?


середа, 10 квітня 2019 р. 09:26:00 UTC+3 користувач googleadsapi-forumadvisor написав:

googleadsapi...@google.com

unread,
Apr 11, 2019, 3:46:37 AM4/11/19
to AdWords API and Google Ads API Forum
Hi,

I have redacted your previous post as it contains sensitive information. Moving forward, I was able to generate the PAID_ORGANIC_QUERY_REPORT from your account on my end. 

See below for the sample query I used:
ReportQuery query = new ReportQuery.Builder()
.fields("KeywordId", "AccountCurrencyCode", "AccountDescriptiveName", "AccountTimeZone", "AdGroupId", "AdGroupName", "AdGroupStatus", "AverageCpc", "AveragePosition", "CampaignId", "CampaignName", "CampaignStatus", "Clicks", "CombinedAdsOrganicClicks", "CombinedAdsOrganicClicksPerQuery", "CombinedAdsOrganicQueries", "Ctr", "CustomerDescriptiveName", "Date", "DayOfWeek", "ExternalCustomerId", "Impressions", "KeywordTextMatchingQuery", "Month", "MonthOfYear", "OrganicAveragePosition", "OrganicClicks", "OrganicClicksPerQuery", "OrganicImpressions", "OrganicImpressionsPerQuery", "OrganicQueries", "Quarter", "QueryMatchType", "SearchQuery", "SerpType", "Week ","Year")
.from(ReportDefinitionReportType.PAID_ORGANIC_QUERY_REPORT)
.during(ReportDefinitionDateRangeType.LAST_7_DAYS).build();

This said, could you provide the complete report definition so we could further check. Please reply via Reply privately to author.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

On 04/10/19 20:31:50 uatet...@gmail.com wrote:
Hi!
What I want to get from report - for example:
campaign   | source    | medium      | term      | clicks    | pay (cost)
test
1     | test_sour | test_med    | test_term | 50        | 160
test
1     | test_sour2| test_med2   | test_term2| 42        | 260
test
1     | test_sour3| test_med3   | test_term | 150       | 546

In this page I read: "The Paid and Organic Query report provides a holistic view of your search stats across ads and organic listings at the query level".
But instead report I have only headers
[2019-04-08 14:39:31] AW_SOAP.INFO: clientCustomerId=353-528-0885 operations=1 service=ReportDefinitionService method=getReportFields responseTime=170 requestId=000586034a2991be0a374b877a05b23d server=adwords.google.com isFault=0 faultMessage=
Reply all
Reply to author
Forward
0 new messages