How to get Campaigns

71 views
Skip to first unread message

devp...@gmail.com

unread,
Aug 31, 2015, 3:07:23 PM8/31/15
to AdWords API Forum
Hi,

I'm a developer working on a test account. I've followed all the steps necessary I believe to the point where I can begin making requests. My MCC manager account dev token is pending, the form has been submitted. However, I understand that I can still do requests under this test account.

I'm running XAMPP and added the newest PHP AdWords library. I've altered the auth.ini file variables to the appropriate strings and followed everything up to the end in this guide, basically.

My main focus is retrieving campaigns (which I understand that test accounts won't have any). So how do I go about creating fake campaigns and retrieving them? Do I need to make a php file? How do I even start the file? This is all just a little overwhelming and I've been trying to find tutorials and follow the GitHub and API Steps, but it's not really working.

Thank you.

Anthony Madrigal

unread,
Aug 31, 2015, 3:54:06 PM8/31/15
to AdWords API Forum
Hi,

Test accounts only differ from production accounts by not serving ads or having live stats. You can either create campaigns through the UI or through the API. Once you have created them, you can retrieve them by following this example. Also, please make sure that your clientCustomerId in your auth.ini file is the ID of a client account, not MCC account.

Cheers,
Anthony
AdWords API Team

devp...@gmail.com

unread,
Sep 2, 2015, 9:01:31 AM9/2/15
to AdWords API Forum
Alright, so I got approved and I followed the example. Literally copy and pasted it. After the "require" line, I added this code from the auth.ini regarding the client account:

$user = new AdWordsUser();
$user->SetClientCustomerId("xxxxxxxxxx");

With credentials filled in.

Now, is this the right way to go about this? I'm running it in command prompt and it's not finding the "init.php" file immediately. Do I have to point to it specifically? Or is there a general php method that can recursively check children folders for this file? Also, from what I'm seeing there are only init.php files in the Examples folders.


Thanet Knack Praneenararat (AdWords API Team)

unread,
Sep 2, 2015, 12:02:22 PM9/2/15
to AdWords API Forum
Hi,

First, I highly recommend to read the guide from our official website instead of third-party website.
First-request guide, get started guide, and getting started section of php client lib README might be very useful to you for getting started.

Basically, after you put all information in the auth.ini, you should be able to run GetCampaigns.php example without adding any more codes.
So, the below line is not necessary.
After the "require" line, I added this code from the auth.ini regarding the client account:
$user = new AdWordsUser();
$user->SetClientCustomerId("xxxxxxxxxx");

Please try the client lib as is before you copy files around to your project directories.

Cheers,
Thanet, AdWords API Team

psc...@gmail.com

unread,
Sep 2, 2015, 3:00:56 PM9/2/15
to AdWords API Forum
(posting from my Production Acct)

I am getting this error: An error has occurred: [AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'<null>']

I believe this is because I am calling this function on a top level MCC account. I have many client accounts under this and they each have their own campaigns. How would I go about this. I have read this but I'm getting a little lost. Also, the snippet code that is provided to link Clients to MCC accounts is in Java and I need it in PHP.

Thanet Knack Praneenararat (AdWords API Team)

unread,
Sep 3, 2015, 5:25:08 AM9/3/15
to AdWords API Forum
Hi,

Unfortunately, we don't have PHP sample codes for that page yet.

But the error CLIENT_CUSTOMER_ID_IS_REQUIRED signals that you haven't set up the clientCustomerId properly.
How did you set your auth.ini file?
With that setting, can you run very simple example like GetCampaigns.php of any of your child accounts?

Cheers,
Thanet, AdWords API Team
Reply all
Reply to author
Forward
0 new messages