My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Documentation for the requested version is not available.Documentation for the requested diff is not available.

Sandbox

Link to this version

The AdSense API sandbox is a replica of the live API services but with some additional support that helps developers test and debug their applications. A developer can use the sandbox to simulate creating an AdSense account for new or existing publishers (or create an AdSense account with no association with a developer), associate those accounts with their own developer account, and then test operations on that account.

The sandbox versions of the WSDLs are located at:

https://sandbox.google.com/api/adsense/vN/SERVICE_NAME?wsdl

For example:

https://sandbox.google.com/api/adsense/v3/AccountService?wsdl

The sandbox has special header elements used for testing and debugging that can be included in a header with request createAdSenseAccount.

Accounts Deleted Once a Month - All sandbox accounts and data are deleted from the sandbox approximately once a month. The pre-populated data for the testsandboxpub@google.com test account is restored as roughly a superset of its previous data (data might not be visible if a channel has been deleted, for example).

Ads Do Not Show - Ad code from the sandbox will not generate live ads. Instead you will see a blank box, public service ads, or whatever is specified by the alternate parameter. This is expected behavior and we will look at the source code of the page when we review applications.

 

Sandbox Developer Account

In order to log in and run tests on the sandbox, you'll need a username and password for a sandbox developer account. If you do not already have login credentials, please complete the AdSense API developer info form and you will receive an email with further instructions. If you do not receive one, please let us know by emailing us at adsenseapi-support@google.com.

To begin with, the developer account is associated with one user account (testsandboxpub@google.com). This user account is pre-populated with report data. This account will come in handy if you are planning to integrate reporting features into your website since sandbox accounts do not accumulate clicks and impressions. We publish sample code for generating an AFC aggregate report for Java, Perl, PHP, Python and C#.

test publisher account
username: testsandboxpub@google.com
client_id: Find its current value at Developer Knowledge Base in the form: ca-pub-################.
NOTE: The client_id may change monthly with each refresh of the sandbox data.

Testing of Account Creation and Association

The sandbox environment allows developers to test the creation of new accounts and association with existing accounts in preparation for release on the live web services.

The live web services require that when a developer creates an account for a publisher, that publisher receives an email which asks them to go to a web page to perform various actions. (For the larger context, see Setting up a Publisher's Account). The sandbox sends the email request to you, the developer (instead of the publisher), which lets you see the messages the publisher would have seen. However, the verification link in that email will not work, because the sandbox doesn't have a replica of the AdSense website to take a publisher to. The special request header elements provide a way to simulate these and other actions related to createAdSenseAccount.

Creating a New Account

When creating a new account, there is one case that requires use of a debug header:

  • Setting an account to "Active" state - The live web service requires that when a developer creates an account for a publisher, that publisher receives an email which asks them to go to a web page to accept an association with that developer. Accepting the association converts the account from Pending to Active. The sandbox instead sends the email request to you, the developer, but because the sandbox doesn't currently have a web page, the developer can specify the active state by passing Active in the debug_association_type header element with a createAdSenseAccount request. This simulates the publisher approving the association of their account with that developer. Moreover, if you are using one of the test developer accounts, the email is never sent.

Associating with an Existing Account

Besides creating new AdSense accounts, a developer can manage existing AdSense accounts. In order to do so, the developer must create an association with an existing AdSense account. This lets developers test the associateExistingAccount request. In the sandbox environment, there are three special cases that require use of the debug headers:

  • Associating with an existing account - In order to test association with an existing account, you need to start with an account that has no association with any developer. You can create such an account by passing the NotAssociated value in debug_association_type with request createAdSenseAccount. (Without this header value, when you create a new account, it is automatically associated with the developer that created the account.)
  • Setting the phone or zip hints - The live site requires the publisher to specify their phone or zip hints on a web page. Because the sandbox currently has no such web page, you can pass these values in with debug_zip and debug_phone with request createAdSenseAccount.

Request Header for Debugging

The sandbox has the following special elements that can be included in a header for request createAdSenseAccount when debugging. These elements enable developers to include zip, phone and approval settings that are normally requested of the publisher by email. These elements can be used in addition to the elements in the normal request header.

These request header elements are optional and can be used only in the sandbox, and only with createAdSenseAccount. They enable you to test association using associateExistingAccount.

  • debug_association_type — the state of the association between the developer and publisher (used only for testing). If this element is not specified, then the Pending state is set. Can have one of the following values:
    • NotAssociated — no association exists between the developer and publisher
    • Pending — the developer has asked the publisher to approve an association with that developer, and the publisher has not yet given approval
    • Active — the developer has asked the publisher to approve an association with that developer, and the publisher has given approval
  • debug_zip — the publisher's zip code (used only for testing)
  • debug_phone — the publisher's phone number (used only for testing)