Coder Social home page Coder Social logo

googleads-adsense-examples's People

Contributors

anashoommen avatar donovanfm avatar josealcerreca avatar lalarustamli avatar sgomes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googleads-adsense-examples's Issues

generateCsv does not return data

Hello, I implemented a project based on the example to generate a report, and in the last week the function stopped working.

I can get the account id, but the following function is not executed

    result = service.accounts().reports().generateCsv() 

and also no error is returned in the api. Is there any idea how to work around the situation to at least try to identify the error?

Update this API

Nevermind, it looks like this is just an example repo and not the actual API am requesting an update for.

Default branch is now main

As part of Google’s ongoing efforts to foster inclusive language, we’ve changed the default branch of this project to main. We encourage contributors to do the same for their forks and local development environments in order to minimize issues when creating pull requests.

Support for v2 in python

Hello and sorry for submitting an issue about this so directly, but I'm having a lot of issues migrating from v1.4 to v2 in python.

I've followed all of the release note changes and keep getting errors about parameters that are supposedly not supported.

I've tried updating google modules and libraries, but to no avail.

So, is there any effort being done to create the examples for v2 before October 2021 since then the API will be deprecated and reports will be empty.

Adsense API returning Error 403 - "The caller does not have permission"

Hi I'm trying to fetch the ad unit details of an Adsense Account using the Adsense Management API. I created the application on google cloud console and got the client_id and client_secret which I used to get the refresh token as well.

I used the following code snippet to get account id and name:

service = discovery.build('adsense', 'v2', credentials = credentials)
	
# Retrieve account list in pages and display data as we receive it.
request = service.accounts().list(pageSize=50)

# while request is not None:
result = request.execute()
print(result)
accounts = result['accounts']

for account in accounts:
	print ('Account with ID "%s" and name "%s" was found. '
			% (account['name'], account['displayName']))

And I was able to get the account name and Id using this , then I further tried to get the ad unit details but I'm getting the mentioned error:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://adsense.googleapis.com/v2/accounts/{account_id}/adclients/{adclient_id}/adunits?pageSize=50&alt=json returned "The caller does not have permission". Details: "The caller does not have permission">

The code snippet I'm using here is:

request = service.accounts().adclients().adunits().list(
parent=f"accounts/{accountId}/adclients/{adClientId}", pageSize=50)

result = request.execute()

Here I'm using the publisher id of the account in the variable - accountId and the customer id in the variable - adClientId.

Am I using the correct IDs? if not from where do I find the ids. If the ids being used are correct then I'm getting this permission error stated above

I have added these scopes as well

https://www.googleapis.com/auth/adsense
https://www.googleapis.com/auth/adsense.readonly

Also I tried the same in the APIs Explorer UI and got the same result

{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}

What permission do I require here or what can be the solution to get the ad units details for Adsense. I would really appreciate the help as I'm stuck since many days.

get_all_custom_channels.py error

In file get_all_custom_channels.py there is small bug:

      while request is not None:
        result = request.execute()
        custom_channels = result['customChannels']

        if 'customChannels' in result:
          for custom_channel in result['customChannels']:

If there is no customChannels in result it will produce error

How to get Google approval?

I have been trying to get approved by Google AdSense for wp websites for many months now . I have tried every which way I can think of . I need clear education how to get approved.

AdSense API returning null in Android 6.0

List items = apiController.getAdsenseService().accounts().list().execute().getItems();

When I run this command in Android 6.0, it always returns null.

java.lang.IllegalArgumentException: the name must not be empty: null

Running same command in previous version of Android works fine.

PHP v2.x examples are outdated/broken (with google/apiclient 2.10)

Not only does new Google_Service_AdSense($client) (in adsense-sample.php) throws an error (because it became Google_Service_Adsense()), but almost all returned JSON strings/objects and function signatures of most of the other functions in the "Example" classes have been changed and are broken as a result.

My google-fu seems to be pretty weak because I can't seem to find the documentation for the most recent version of the Google ADSENSE Service (only the core Google Service), is there any detailed recent documentation of the Adsense client class(es)/functions?

Thx in advance!

get account sub-account tree empty

hello,
I want to get the sub-account tree under my current account by account id, get it according to the examples method, and respond to an empty object. In fact, the account has been bound to 7 sub accounts.

https://github.com/googleads/googleads-adsense-examples/blob/master/php-clientlib-1.x/v1.x/examples/GetAccountTree.php

        $pageToken = null;
        $optParams['maxResults'] = 500;
        $optParams['pageToken'] = $pageToken;
        $result = $this->service->accounts->listAccounts($optParams);
        $accounts = null;

        if (!empty($result['items'])) {
            $accounts = $result['items'];
            foreach ($accounts as $account) {
                $this->account_id = $account['id'];
            }
        }
        $subAccounts = $this->service->accounts->get($this->account_id, array('tree' => true));
        if (!empty($subAccounts['subAccounts'])){
            foreach ($subAccounts['subAccounts']  as $account) {
                dump($account);
            }
        }
    dd($subAccounts); 

response:

Google_Service_AdSense_Account^ {#1363
  #collection_key: "subAccounts"
  #internal_gapi_mappings: array:1 [
    "creationTime" => "creation_time"
  ]
  +creationTime: "1551266190244"
  +id: "pub-*********"
  +kind: "adsense#account"
  +name: "*********"
  +premium: false
  #subAccountsType: "Google_Service_AdSense_Account"
  #subAccountsDataType: "array"
  +timezone: "Europe/London"
  #modelData: array:1 [
    "creation_time" => "1551266190244"
  ]
  #processed: []
}

There is a weird problem if I dump dd($subAccounts,$subAccounts['subAccounts']);

response:

Google_Service_AdSense_Account^ {#1363
  #collection_key: "subAccounts"
  #internal_gapi_mappings: array:1 [
    "creationTime" => "creation_time"
  ]
  +creationTime: "1551266190244"
  +id: "pub-*********"
  +kind: "adsense#account"
  +name: "*********"
  +premium: false
  #subAccountsType: "Google_Service_AdSense_Account"
  #subAccountsDataType: "array"
  +timezone: "Europe/London"
  #modelData: array:2 [
    "creation_time" => "1551266190244"
    "subAccounts" => []
  ]
  #processed: array:1 [
    "subAccounts" => true  //  not empty
  ]
}

Adsense Quickstart App crashing on start

Solved the error that occurred when the app starts. App starts, then onCreate is called, then onNavigationItemSelected(..) is called, then refreshView() is called because at this point publisherAccountId is null, which then calls apiController.loadAccounts() which has an invalid credential name because no account name was ever set.

The app was trying to loadaccounts from null user.

Change in MainActivity:

  • if ((apiController.getAccounts() == null) || (publisherAccountId == null)) {
  •  status = AppStatus.GETTING_ACCOUNT_ID;
    
  •  refreshView();
    
  •  return true;
    

To:

  • if ((apiController.getAccounts() == null) && (publisherAccountId == null)) {
  •    chooseDeviceAccount();
    
  •    return true;
    
  • } else if ((apiController.getAccounts() == null) || (publisherAccountId == null)) {
  •    status = AppStatus.GETTING_ACCOUNT_ID;
    
  •    refreshView();
    
  •    return true;
    
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.