Google Ads Exclude/Ip Block API in PHP

121 views
Skip to first unread message

rajit bansal

unread,
Jan 9, 2019, 1:28:36 PM1/9/19
to AdWords API and Google Ads API Forum
I needed API to block certain IPs, which i can use to block fraudent clicks on the go to avoid going damage once a VPN or bad ip is detected.
I tried searching a lot but all i got was about adwords api not google ads api . 
Please help with link and example

Teja Makani

unread,
Jan 9, 2019, 6:11:52 PM1/9/19
to AdWords API and Google Ads API Forum
Hello Rajit,

Could you please confirm whether you are referring to the Google Ads API Beta? In such case you could use Campaign Criterion.ip_block.ip_address field to add the IPs to block. As the API is evolving and at this point of time we do not have any samples and documentation for this. I will update my team on this concern and let you know once I have more information.

Regards,
Sai Teja, AdWords API Team

rajit bansal

unread,
Jan 22, 2019, 9:27:28 AM1/22/19
to AdWords API and Google Ads API Forum
even adwords api will do if google ads one is in progress

googleadsapi...@google.com

unread,
Jan 22, 2019, 4:15:28 PM1/22/19
to AdWords API and Google Ads API Forum
Hello Rajit,

Using the GoogleAdsAPI you could use the CampaignCriteriaonService and set the CampaignCriterion to negative to exclude (true) the criterion and can add IpBlockInfo to exclude the IP's from your targeting. You could use the code sample AddCampaignTargetingCriteria.java and follow the same pattern to exclude the IP's. Code samples in other languages can be found here.

You would be able to exclude IP's using AdWords API as well. You have to use CampaignCriterionService and set the NegativeCampaignCriterion to
IpBlock. please let me know if you have any further questions. You could use the code sample AddCampaignTargetingCriteria.java and follow the same pattern to exclude the IP's. Code samples in other languages can be found here.



Regards,
Sai Teja, AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

rajit bansal

unread,
Jan 23, 2019, 10:04:16 AM1/23/19
to AdWords API and Google Ads API Forum
I Required the same in php language but i have checked both the links you provided its not in the code samples for php

googleadsapi...@google.com

unread,
Jan 23, 2019, 4:56:57 PM1/23/19
to AdWords API and Google Ads API Forum
Hello Rajit,

The same code samples mentioned earlier can be found for both AdWords API and Google Ads API. For AdWords API you can refer the code sample AddCampaignTargetingCriteria.php and for Google Ads API you could refer the code sample AddCampaignTargetingCriteria.php. Also, you could refer to the code snippet in php in this thread to add IP exclusions for AdWords API. Please let me know if you have any further questions.


Regards,
Sai Teja, AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Reply all
Reply to author
Forward
0 new messages