Skip to content

Commit

Permalink
Changes for release in March 2023. (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiboknacky authored Mar 20, 2023
1 parent 557e57b commit b783f21
Show file tree
Hide file tree
Showing 4,051 changed files with 33 additions and 404,020 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 19.0.0
* Removed support for v11 of Google Ads API.
* Updated CreateExperiment example.

## 18.0.0
* Added support for v13 of Google Ads API.
* Removed support for v10 of Google Ads API.
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ API](https://developers.google.com/google-ads/api/docs/start).

## Getting started

### Running code examples

Follow the below steps if you want to try our code examples.

1. Clone this project in the directory of your choice via:

git clone https://github.com/googleads/google-ads-php.git
Expand Down Expand Up @@ -82,20 +86,6 @@ API](https://developers.google.com/google-ads/api/docs/start).
mechanism. Choose the appropriate option below based on your use case, and
read and follow the instructions that the example prints to the console.

**If you already have credentials for the AdWords API...**

* If you have the `adsapi_php.ini` file you used for the AdWords API,
copy and name it as `google_ads_php.ini`. Simply change the section name
from `[ADWORDS]` to `[GOOGLE_ADS]`.

* If you don't have the file, copy the sample `google_ads_php.ini` to your
[home
directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system).
This library determines the home directory of your computer by using
[`EnvironmentalVariables::getHome()`](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Util/EnvironmentalVariables.php#L36).

**If you're accessing the Google Ads API using your own credentials...**

* Copy the sample [`google_ads_php.ini`](examples/Authentication/google_ads_php.ini)
to your [home
directory](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system).
Expand Down Expand Up @@ -134,6 +124,16 @@ API](https://developers.google.com/google-ads/api/docs/start).
in the source code of these examples. These are only used for technical purposes,
you can completely disregard them.

### Installing the library as your project's dependency

1. Change into the root directory of your project.
1. Run `composer require googleads/google-ads-php` at the command prompt. This
will install this library and all its dependencies in the `vendor/`
directory of your project's root directory.
1. **Set up your OAuth2 credentials** like described in the previous section.
1. You can now use this library by importing its classes like shown in the [code
examples](examples/).

## Basic usage

### Instantiate a client
Expand Down
57 changes: 14 additions & 43 deletions examples/CampaignManagement/CreateExperiment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Google\Ads\GoogleAds\V13\Enums\CampaignExperimentTrafficSplitTypeEnum\CampaignExperimentTrafficSplitType;
use Google\Ads\GoogleAds\V13\Enums\ExperimentStatusEnum\ExperimentStatus;
use Google\Ads\GoogleAds\V13\Enums\ExperimentTypeEnum\ExperimentType;
use Google\Ads\GoogleAds\V13\Enums\ResponseContentTypeEnum\ResponseContentType;
use Google\Ads\GoogleAds\V13\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V13\Resources\Campaign;
use Google\Ads\GoogleAds\V13\Resources\CampaignExperiment;
Expand Down Expand Up @@ -122,14 +123,12 @@ public static function runExample(

$experimentResourceName =
self::createExperimentResource($experimentServiceClient, $customerId);
$treatmentArmResourceName = self::createExperimentArms(
$draftCampaignResourceName = self::createExperimentArms(
$googleAdsClient,
$customerId,
$campaignId,
$experimentResourceName
);
$draftCampaignResourceName =
self::fetchDraftCampaign($googleAdsClient, $customerId, $treatmentArmResourceName);
self::modifyDraftCampaign($googleAdsClient, $customerId, $draftCampaignResourceName);

// When you're done setting up the experiment and arms and modifying the draft campaign,
Expand Down Expand Up @@ -211,53 +210,25 @@ private static function createExperimentArms(

// Issues a request to create the experiment arms.
$experimentArmServiceClient = $googleAdsClient->getExperimentArmServiceClient();
$response = $experimentArmServiceClient->mutateExperimentArms($customerId, $operations);
$response = $experimentArmServiceClient->mutateExperimentArms(
$customerId,
$operations,
// We want to fetch the draft campaign IDs from the treatment arm, so the easiest way
// to do that is to have the response return the newly created entities.
['responseContentType' => ResponseContentType::MUTABLE_RESOURCE]
);
// Results always return in the order that you specify them in the request.
// Since we created the treatment arm last, it will be the last result. If
// you don't remember which arm is the treatment arm, you can always filter
// the query in the next section with `experiment_arm.control = false`.
// Since we created the treatment arm last, it will be the last result.
$controlArmResourceName = $response->getResults()[0]->getResourceName();
$treatmentArmResourceName =
$response->getResults()[count($operations) - 1]->getResourceName();
$treatmentArm = $response->getResults()[count($operations) - 1];
print "Created control arm with resource name '$controlArmResourceName'" . PHP_EOL;
print "Created treatment arm with resource name '$treatmentArmResourceName'" . PHP_EOL;
print "Created treatment arm with resource name '{$treatmentArm->getResourceName()}'"
. PHP_EOL;

return $treatmentArmResourceName;
return $treatmentArm->getExperimentArm()->getInDesignCampaigns()[0];
}
// [END create_experiment_2]

/**
* Fetches the draft campaign of the experiment treatment arm.
*
* @param GoogleAdsClient $googleAdsClient the Google Ads API client
* @param int $customerId the customer ID
* @param string $treatmentArmResourceName the treatment arm's resource name
* @return string the draft campaign's resource name
*/
// [START create_experiment_3]
private static function fetchDraftCampaign(
GoogleAdsClient $googleAdsClient,
int $customerId,
string $treatmentArmResourceName
): string {
// Fetches information about the in design campaigns and prints out its resource
// name. The `in_design_campaigns` represent campaign drafts, which you can modify
// before starting the experiment.
$query = "SELECT experiment_arm.in_design_campaigns FROM experiment_arm"
. " WHERE experiment_arm.resource_name = '$treatmentArmResourceName'";
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$response = $googleAdsServiceClient->search($customerId, $query);

// In design campaigns returns as an array, but for now it can only ever contain a single
// ID, so we just grab the first one.
/** @var GoogleAdsRow $googleAdsRow */
$googleAdsRow = $response->getIterator()->current();
$draftCampaignResourceName = $googleAdsRow->getExperimentArm()->getInDesignCampaigns()[0];
print "Found draft campaign with resource name '$draftCampaignResourceName'" . PHP_EOL;

return $draftCampaignResourceName;
}
// [END create_experiment_3]

/**
* Modifies the draft campaign to simulate the experiment where you're testing changing
Expand Down
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/AdAsset.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/Bidding.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/Dates.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/FeedCommon.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/Metrics.php
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/Policy.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/TextLabel.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Common/Value.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/AccessRole.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/AdGroupStatus.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/AdType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/AppStore.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/AssetSource.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/BudgetType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/CallType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/Device.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/FeedOrigin.php
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/FeedStatus.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/GenderType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/InvoiceType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/LabelStatus.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/MimeType.php
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/MinuteOfHour.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/SharedSetType.php
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed metadata/Google/Ads/GoogleAds/V11/Enums/Slot.php
Binary file not shown.
Loading

0 comments on commit b783f21

Please sign in to comment.