Re: v4 add url channel, client id not acknowledged as valid

154 views
Skip to first unread message

Jose Alcérreca (AdSense API Team)

unread,
Nov 30, 2012, 6:12:45 AM11/30/12
to adsen...@googlegroups.com
Hi,

On the first call you are listing the ad clients from a publisher's account. On the second, you are trying to list your own URL channels, using someone else's ad client. 

Use the APIs explorer at the bottom of each method documentation page for tests:


This will list your ad clients so that you can manage your URL channels, but you can't manage your publisher's. In v3 of the API, you could manage your publisher's channels directly but in v4.1 this is no longer necessary since it's possible to generate ad code with host channels now. This allows you to use your own channels across all of your publishers.

Let me know if you have further questions.

Cheers,
Jose


---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers.google.com/adsense


On Friday, 30 November 2012 08:13:24 UTC, Group Participant wrote:
Calling either list or get with Accounts.adclients with a given account id returns a client id. 

array (
  'kind' => 'adsensehost#adClients',
  'etag' => '"WDpz7IXGSofGMoOI-hSw6iBksl4/krHBlIr0QFFqVtjBVao0sw"',
  'items' =>
  array (
    0 =>
    array (
      'kind' => 'adsensehost#adClient',
      'id' => 'ca-pub-<id number>',
      'productCode' => 'AFC',
      'supportsReporting' => true,
    ),
  ),
)

Calling either insert or list with Urlchannels with that client id

https://www.googleapis.com/adsensehost/v4.1/adclients/ca-pub-<id number from above>/urlchannels?key=<key>%40developer.gserviceaccount.com

raises

(404) Ad client not found.

Group Participant

unread,
Dec 2, 2012, 8:08:49 PM12/2/12
to adsen...@googlegroups.com
Thank you for your reply.

In an existing v3 application at my organization, to generate a report for a publisher's client, first the client's channels are retrieved.

If a host cannot access a publisher's client's channels using v4, that seems to mean that data corresponding to those client channels are no longer accessible and our existing application can no longer generate reports on that data.

Is this correct, and if so, can you suggest a workaround?

If needed, specifics for the existing application's logic for generating the report are below.

1) The client's channels are retrieved.
2) An AFCChannelReport object is created.
3) The "channels" property of the object in step 2 is set to the channels retrieved in step 1.
4) ReportService.generateReport is called; its parameter is set to be the object created in steps 2 and 3.

(Client channels are retrieved using the getChannels method of the sensapility api client, which seems not to match the getChannels method of ChannelService; the api client's method is being called with an id in the form 'ca-pub-<number>' and a channel type of either 'Url' or 'Custom'.)

2012年11月30日金曜日 20時12分45秒 UTC+9 Jose Alcérreca (AdSense API Team):

Jose Alcérreca (AdSense API Team)

unread,
Dec 3, 2012, 9:13:12 AM12/3/12
to adsen...@googlegroups.com
Hi again,

You don't need to manage publisher's channels anymore with v4.1. Now we use host channels, so you can use channels across multiple publishers.

In order to use Custom Channels, set the optional argument (hostCustomChannelId) when creating code for ad units. For URL channels, create them using the URL pattern that matches your publisher's address. These channels only belong to the host so you have access to them. 

If you need to generate reports for a channel, use the dimensions CUSTOM_CHANNEL_ID or URL_CHANNEL_ID to distinguish between them or, if you want data for a particular channel, use filters as following:

filter=CUSTOM_CHANNEL_ID%3D%3D<your_custom_channel_id>

I hope this helps. 

Cheers,
Jose


---

Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers.google.com/adsense


Group Participant

unread,
Dec 3, 2012, 6:15:16 PM12/3/12
to adsen...@googlegroups.com
Thank you for the reply, but I need a little more clarification, please.

Even if there is no longer a need to manage publishers' channels, there are data associated with those channels.  In the v3 application, reports are generated for that data.

If the publishers' channels and the associated data cannot be accessed via 4.1, how can the report be generated for that data?

Is there an alternative way to access the same data and calculate report results?

2012年12月3日月曜日 23時13分12秒 UTC+9 Jose Alcérreca (AdSense API Team):

Jose Alcérreca (AdSense API Team)

unread,
Dec 5, 2012, 8:21:39 AM12/5/12
to adsen...@googlegroups.com
Hi,

What specific data do you need to access? Host data from the publishers' channels or publisher data?

Cheers,
Jose

---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers .google.com/adsense


Group Participant

unread,
Dec 5, 2012, 8:55:22 PM12/5/12
to adsen...@googlegroups.com
In the current v3 application, the channels for which reports are being generated correspond with client ids.  That is, channels are retrieved for a given client id and reports are generated for those channels.  The specific data I need to access is that of client channels.

I assume that clients are associated with publishers but not hosts.  If that is correct, then I also assume that the client data is considered publisher data.

2012年12月5日水曜日 22時21分39秒 UTC+9 Jose Alcérreca (AdSense API Team):
Message has been deleted

Jose Alcérreca (AdSense API Team)

unread,
Dec 6, 2012, 8:36:41 AM12/6/12
to adsen...@googlegroups.com
Hi!

Publisher channels will not be accessible from v4.1, I'm afraid. You will be able to access the same data, but not with the old channels. You can create new ones when generating ad code and they will start collecting data from that point.

Cheers,
Jose

---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers .google.com/adsense


Group Participant

unread,
Dec 7, 2012, 3:41:34 AM12/7/12
to adsen...@googlegroups.com
Is the following correct?

Given:
1. Publisher channel p1 is associated with adunit a1.
2. a1 contains data; let's give the data the label d1.

With v3 I called ReportService.generate with p1 to get d1.  With v4.1, accessing p1 is no longer possible, and so d1 cannot be accessed in the same manner as v3.

In order to access d1 via v4.1:
1. A host channel h1 is created.
2. h1 is set to be associated with a1.
3. Calling Reports.generate with CUSTOM_CHANNEL_ID==h1 as a filter will return d1.

2012年12月6日木曜日 22時36分41秒 UTC+9 Jose Alcérreca (AdSense API Team):

Jose Alcérreca (AdSense API Team)

unread,
Dec 7, 2012, 6:33:53 AM12/7/12
to adsen...@googlegroups.com
Hi,

It is correct (and thorough :) but I'd add a remark: d1 in v3 and in v4.1 are different datasets. The moment you start using v4.1 channels, you stop collecting data for v3's a1.

So let me modify slightly your approach:

1. Publisher channel p1_v3 is associated with adunit a1_v3.
2. a1_v3 contains data; let's give the data the label d1_v3.

In order to access d2_v4 via v4.1:
1. A host channel h2_v4 is created.
2. h2_v4 is set to be associated with a2_v4.
3. Calling Reports.generate with CUSTOM_CHANNEL_ID==h2_v4 as a filter will return d2_v4.


The bottom line is that you won't be able to access d1_v3 with Reports.generate from v4.1. If you provide monthly reports to your publishers and you switch on the 15th, you may need to merge "old" and "new" data.

Cheers,
Jose

---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers .google.com/adsense

Group Participant

unread,
Dec 9, 2012, 7:22:24 PM12/9/12
to adsen...@googlegroups.com
On your message from the 6th, you wrote


You will be able to access the same data, but not with the old channels.

The gist of your message below seems to be


you won't be able to access d1_v3 with Reports.generate from v4.1

which appears to me to contradict the earlier message, saying that I will *not* be able to access the same data, with either old channels or new channels.

Can you tell me what I'm missing here?

About this suggestion,


you may need to merge "old" and "new" data

can you give a hint as to where this method is explained in the documentation?  Or if there is no online documentation, could you give brief instructions on merging data, and maybe also an explanation as to what you mean by merging data?  I don't recall seeing anything in the Adsense docs about that topic.

2012年12月7日金曜日 20時33分53秒 UTC+9 Jose Alcérreca (AdSense API Team):

Jose Alcérreca (AdSense API Team)

unread,
Dec 10, 2012, 5:37:48 AM12/10/12
to adsen...@googlegroups.com
Hi,

You can access the same metrics and dimensions to generate reports. When you switch channels there is a clean start, so v3 data is not available from v4.1.

Merging data depends on your implementation and needs, there is no documentation available for that. 

I'll contact you by e-mail to learn about your specific requirements.

Cheers,
Jose

---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers .google.com/adsense

Reply all
Reply to author
Forward
0 new messages