Posts tagged with google-ads-api

I recently integrated google_mobile_ads plugin for Flutter after firebase_admob plugin got deprecated. Ever since then my Rewarded Ads stopped working. These are the errors I get:

(13077): This request is sent from a test device. E/chromium(13077): [ERROR:cookie_manager.cc(137)] Strict Secure Cookie policy does not allow setting a secure cookie for http://googleads.g.doubleclick.net/ for apps targeting >= R. Please either use the 'https:' scheme for this URL or omit the 'Secure' directive in the cookie value. W/Ads (13077): #004 The webview is destroyed. Ignoring action.

My code is as below:

void main() {   WidgetsFlutterBinding.ensureInitialized();   MobileAds.instance.initialize();   InAppPurchaseConnection.enablePendingPurchases();   runApp(MyApp()); } class _RewardedVideoState extends State<RewardedVideo>{   bool _rewardedReady = false;   RewardedAd _rewardedAd;   static final AdRequest _adRequest = AdRequest(     keywords: <String>['Puzzles', 'Games', 'Word Games'],     nonPersonalizedAds: true,   );   @override   void didChangeDependencies() {     createRewardedAd();     super.didChangeDependencies();   }   void createRewardedAd([Score userScore]) {     print('Inside createRewardedAd');     // RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("CFA70A4A1BD59DA3323D586CA8BD2541"))     _rewardedAd = RewardedAd(       adUnitId: RewardedAd.testAdUnitId,       request: _adRequest,       listener: AdListener(           onAdLoaded: (Ad ad) {             print('${ad.runtimeType} loaded. RADHA ');             _rewardedReady = true;           },           onAdFailedToLoad: (Ad ad, LoadAdError error) {             print('${ad.runtimeType} failed to load: $error');             ad.dispose();             _rewardedAd = null;             createRewardedAd(userScore);           },           onAdOpened: (Ad ad) => print('${ad.runtimeType} onAdOpened.'),           onAdClosed: (Ad ad) {             print('${ad.runtimeType} closed.');             ad.dispose();             createRewardedAd(userScore);           },           onApplicationExit: (Ad ad) =>               print('${ad.runtimeType} onApplicationExit.'),           onRewardedAdUserEarnedReward: (RewardedAd ad, RewardItem reward) {             userScore.updateHintsEarned(reward.amount);           }),     )..load();     print('Completed RewardedAd Load ' + _rewardedAd.toString());   }   @override   void dispose() {     _rewardedAd.dispose();     super.dispose();   }   @override   Widget build(BuildContext context) {     final Score userScore = Provider.of<Score>(context, listen: false);     print('Inside RewardedVideo widget *** ........');     try {       if (_rewardedReady) {         print('Showing rewardedAd ***');         _rewardedAd.show();         _rewardedReady = false;         _rewardedAd = null;       } else         createRewardedAd(userScore);     } catch (e) {       print("error in showing ad: " + e.toString());     }     return SizedBox(       height: 0,     );   } } 

I am able to get banner ads (not included in this code) but rewarded ad does not load at all. Any idea what might be going wrong here?

I'm using BigQuery to store our Google Ads campaign performance information for our clients. To pull the data, I'm using a very simple query:

select * from yl-adwords.ads.AdBasicStats_[our manager ID] where ExternalCustomerId = [our media client's ID]

This query pulls back to 1/17/21. We took on this new client on 2/16/21, so we're able to get the past 30 days of data. However, the Google Ads account data goes back to 2019.

What's odd is for our other client accounts, when we get access using similar queries, we can pull back historical data with no issue. We're pulling others back to 2018, even though we started working with them ini 2020.

Do I need to schedule a backfill in BQ to get this new data? Or has anyone else experienced this issue?

first of all, I want to add google_mobile_ads in my pubspec. after adding it the pod install command return 404 not found.

after it, I remove my podfile & podfile.lock and run flutter clean & pod cache clean --all and trying to run again and FirebaseAnalytic & GoogleSignIn return 404 not found too.

I am developing an application which integrates with Google Ads and syncing Ad/Campaign etc. data into my servers. I am getting authorization related error when I try to request some data from Google Ads API. Here is the steps I have done by now:

  • Applied to Google in terms of validating an OAuth application and scopes (Done, we got verification from Google and can ask for AdWords scope)
  • Applied to Google Ads for getting a developer token and got it. (Basic Access)
  • We are able to connect test accounts and successfully getting the response. But when we try it with real accounts we get the error below.

The code is also from the original Google Ads API example. I have tried with tons of different accounts but none of them seems to be working. When I try to obtain those data with same parameters from AdWords API instead of Google Ads API, it works. But Google AdWords PHP SDK is no longer maintained so I have to keep trying with Google Ads API. I share my code below:

{     $this->customerId = $customerId;     $this->clientId = $clientId;     $this->clientSecret = $clientSecret;     $this->accessToken = $accessToken;     $oAuth2Credential = (new OAuth2TokenBuilder())         ->withClientId($this->clientId)         ->withClientSecret($this->clientSecret)         ->withRefreshToken($this->accessToken)         ->build();     $this->googleAdsClient = (new GoogleAdsClientBuilder())         ->withOAuth2Credential($oAuth2Credential)         ->withDeveloperToken(env("GOOGLE_DEVELOPER_TOKEN"))         ->withLoginCustomerId((int) $this->customerId)         ->build(); } public function getCampaigns(): array{     try {         $campaigns = [];         $services = $this->googleAdsClient->getGoogleAdsServiceClient();         $results = $services->search($this->customerId, $this->campaignQuery(), ['pageSize' => self::PAGE_SIZE]);         foreach ($results->iterateAllElements() as $row) {             $campaigns[] = (new Campaign())->transform($row);         }         return $campaigns;     } catch (GoogleAdsException $googleAdsException) {         // TODO add error log         return [];     } }``` The error: ```Google\ApiCore\ApiException: {     "message": "The caller does not have permission",     "code": 7,     "status": "PERMISSION_DENIED",     "details": [         {             "@type": 0,             "data": "type.googleapis.com\/google.ads.googleads.v6.errors.GoogleAdsFailure"         },         {             "@type": 0,             "data": [                 {                     "errorCode": {                         "authorizationError": "DEVELOPER_TOKEN_PROHIBITED"                     },                     "message": "Developer token is not allowed with project '691752477594'."                 }             ]         }     ]}```   

I'm trying to get reports for my google ads and display them on a dashboard for easier viewing and monitoring.

I've gone through the whole process to authenticate my account. I got all the keys needed. Everything works up until the query is run. See code below copied from Google ads API examples

#!/usr/bin/env python # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #     https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """This example illustrates how to get all campaigns. To add campaigns, run add_campaigns.py. """ import argparse import sys from google.ads.google_ads.client import GoogleAdsClient from google.ads.google_ads.errors import GoogleAdsException def main(client, customer_id):     ga_service = client.get_service("GoogleAdsService", version="v6")     query = """         SELECT campaign.id, campaign.name         FROM campaign         ORDER BY campaign.id"""     # Issues a search request using streaming.     response = ga_service.search_stream(customer_id, query=query)     try:         for batch in response:             for row in batch.results:                 print(                     f"Campaign with ID {row.campaign.id} and name "                     f'"{row.campaign.name}" was found.'                 )     except GoogleAdsException as ex:         print(             f'Request with ID "{ex.request_id}" failed with status '             f'"{ex.error.code().name}" and includes the following errors:'         )         for error in ex.failure.errors:             print(f'\tError with message "{error.message}".')             if error.location:                 for field_path_element in error.location.field_path_elements:                     print(f"\t\tOn field: {field_path_element.field_name}")         sys.exit(1) if __name__ == "__main__":     # GoogleAdsClient will read the google-ads.yaml configuration file in the     # home directory if none is specified.     google_ads_client = GoogleAdsClient.load_from_storage()     parser = argparse.ArgumentParser(         description="Lists all campaigns for specified customer."     )     # The following argument(s) should be provided to run the example.     parser.add_argument(         "-c",         "--customer_id",         type=str,         required=True,         help="The Google Ads customer ID.",     )     args = parser.parse_args()     main(google_ads_client, args.customer_id) 

Nothing gets printed to my console. When I print out print(response) i get <google.api_core.grpc_helpers._StreamingResponseIterator object at 0x7fb7dcaaf3d0>

I get no errors, tracebacks nothing. This is what my console looks like (hiding customer_id):