Configure a proxy

  • Connect to the Google Ads API through a proxy by setting the proxy property in your googleads.properties file.

  • Alternatively, configure the proxy setting programmatically when creating the Google::Ads::GoogleAds::GoogleAdsClient object.

If you need to connect to the Google Ads API through a proxy server, you can configure the Perl client library using your googleads.properties file or programmatically in your application code.

Use googleads.properties

You can set the proxy property in the Network Connection section of your googleads.properties file:

### Network Connection ###

# Optional proxy server URL to be used for internet connectivity.
# If your proxy connection requires authentication, make sure to include it in
# the URL, for example: http://user:password@proxy_hostname:8080
proxy=INSERT_PROXY_HERE

For example, you can specify http://user:pass@localhost:8082 as a proxy.

Programmatic configuration

Alternatively, you can configure the proxy setting programmatically just like any other configuration setting:

my $api_client = Google::Ads::GoogleAds::Client->new({
  proxy => "INSERT_PROXY_HERE",
});

You can also set the GOOGLE_ADS_PERL_PROXY environment variable and load it using $api_client->configure_from_environment_variables():

export GOOGLE_ADS_PERL_PROXY=http://user:password@proxy_hostname:8080