Fetching campaigns detail via google ads php client library.

500 views
Skip to first unread message

Khushal Nayani

unread,
Sep 5, 2023, 2:58:51 PM9/5/23
to Google Ads API and AdWords API Forum
I am trying to create a web application where my clients can view their campaign data. I am using Google Ads PHP Client Library for this application.

Done installation as per given instructions. Took GetCampaigns.php file from examples and modified to get desired details of campaign. But here I want to get the result of GetCampaigns file in another file so that the class file gets separated and I can work on results further.

So I want to know that how can I access GetCampaign Class main method from GetCampaigns.php file to other file.

Location of Files
GetCampaigns.php - project/GoogleAdsPhp/GetCampaigns.php
test.php - project/test.php

Find the files in attachment
test21.php
GetCampaigns.php

Google Ads API Forum Advisor

unread,
Sep 5, 2023, 5:29:15 PM9/5/23
to khusha...@gmail.com, adwor...@googlegroups.com

Hi Khushal,

Thanks for reaching out to the Google Ads API Team. I hope you are doing well today.

In relation to your concern, you may see the Get Campaigns (https://developers.google.com/google-ads/api/samples/get-campaigns#php).

In addition, it appears that your concern is more on implementation or integration of our client libraries rather than anything specific to Google Ads API (https://developers.google.com/google-ads/api/docs/first-call/overview) itself. Since this is more of an implementation or integration specific issue, then we would recommend also reaching out to the developer who maintains our PHP client libraries here (https://github.com/googleads/google-ads-php).

Have a great day.
 

This message is in relation to case "ref:_00D1U1174p._5004Q2oib1V:ref"

Thanks,

 
Google Logo Google Ads API Team


Varinder Sohal

unread,
May 7, 2024, 8:41:11 PM5/7/24
to Google Ads API and AdWords API Forum
Thank you so much for these conversions it helps me a lot but I have another query how can I filter Google ads campaign data with a date range filter?

Suppose I want to get last week's clicks, impressions last week's cost, etc. I googled a lot about this but somewhere I read about segments and I don't want to filter data according to segments because I see on the official dashboard of Google Ads how segments filter work.

Note: I have done a complete setup of PHP SDK and completed the code to get the active campaigns.

Find the files in attachment
campaigns.php

Google Ads API Forum Advisor

unread,
May 8, 2024, 3:45:43 AM5/8/24
to varinde...@gmail.com, adwor...@googlegroups.com
Hi,

Unfortunately, retrieving clicks and other metrics for the last week, specifically without segments in the Google Ads API isn't possible. Segments are the primary way to filter data based on date ranges in the Google Ads API.

I hope this clarifies.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02oib1V:ref" (ADR-00197023)


Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages