Google Analytics Admin V1alpha Client - Class AnalyticsAdminServiceClient (0.23.0)

Reference documentation and code samples for the Google Analytics Admin V1alpha Client class AnalyticsAdminServiceClient.

Service Description: Service Interface for the Analytics Admin API (GA4).

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
try {
    $formattedProperty = $analyticsAdminServiceClient->propertyName('[PROPERTY]');
    $acknowledgement = 'acknowledgement';
    $response = $analyticsAdminServiceClient->acknowledgeUserDataCollection($formattedProperty, $acknowledgement);
} finally {
    $analyticsAdminServiceClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Analytics \ Admin \ V1alpha

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

acknowledgeUserDataCollection

Acknowledges the terms of user data collection for the specified property.

This acknowledgement must be completed (either in the Google Analytics UI or through this API) before MeasurementProtocolSecret resources may be created.

Parameters
Name Description
property string

Required. The property for which to acknowledge user data collection.

acknowledgement string

Required. An acknowledgement that the caller of this method understands the terms of user data collection.

This field must contain the exact value: "I acknowledge that I have the necessary privacy disclosures and rights from my end users for the collection and processing of their data, including the association of such data with the visitation information Google Analytics collects from my site and/or app property."

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AcknowledgeUserDataCollectionResponse
Example
use Google\Analytics\Admin\V1alpha\AcknowledgeUserDataCollectionRequest;
use Google\Analytics\Admin\V1alpha\AcknowledgeUserDataCollectionResponse;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedProperty The property for which to acknowledge user data collection. Please see
 *                                  {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $acknowledgement   An acknowledgement that the caller of this method understands the
 *                                  terms of user data collection.
 *
 *                                  This field must contain the exact value:
 *                                  "I acknowledge that I have the necessary privacy disclosures and rights
 *                                  from my end users for the collection and processing of their data,
 *                                  including the association of such data with the visitation information
 *                                  Google Analytics collects from my site and/or app property."
 */
function acknowledge_user_data_collection_sample(
    string $formattedProperty,
    string $acknowledgement
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new AcknowledgeUserDataCollectionRequest())
        ->setProperty($formattedProperty)
        ->setAcknowledgement($acknowledgement);

    // Call the API and handle any network failures.
    try {
        /** @var AcknowledgeUserDataCollectionResponse $response */
        $response = $analyticsAdminServiceClient->acknowledgeUserDataCollection($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedProperty = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $acknowledgement = '[ACKNOWLEDGEMENT]';

    acknowledge_user_data_collection_sample($formattedProperty, $acknowledgement);
}

approveDisplayVideo360AdvertiserLinkProposal

Approves a DisplayVideo360AdvertiserLinkProposal.

The DisplayVideo360AdvertiserLinkProposal will be deleted and a new DisplayVideo360AdvertiserLink will be created.

Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLinkProposal to approve. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ApproveDisplayVideo360AdvertiserLinkProposalResponse
Example
use Google\Analytics\Admin\V1alpha\ApproveDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\ApproveDisplayVideo360AdvertiserLinkProposalResponse;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLinkProposal to approve.
 *                              Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName()} for help formatting this field.
 */
function approve_display_video360_advertiser_link_proposal_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ApproveDisplayVideo360AdvertiserLinkProposalRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ApproveDisplayVideo360AdvertiserLinkProposalResponse $response */
        $response = $analyticsAdminServiceClient->approveDisplayVideo360AdvertiserLinkProposal($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]'
    );

    approve_display_video360_advertiser_link_proposal_sample($formattedName);
}

archiveAudience

Archives an Audience on a property.

Parameters
Name Description
name string

Required. Example format: properties/1234/audiences/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\ArchiveAudienceRequest;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Example format: properties/1234/audiences/5678
 *                              Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function archive_audience_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ArchiveAudienceRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveAudience($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    archive_audience_sample($formattedName);
}

archiveCustomDimension

Archives a CustomDimension on a property.

Parameters
Name Description
name string

Required. The name of the CustomDimension to archive. Example format: properties/1234/customDimensions/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\ArchiveCustomDimensionRequest;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CustomDimension to archive.
 *                              Example format: properties/1234/customDimensions/5678
 *                              Please see {@see AnalyticsAdminServiceClient::customDimensionName()} for help formatting this field.
 */
function archive_custom_dimension_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ArchiveCustomDimensionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveCustomDimension($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::customDimensionName(
        '[PROPERTY]',
        '[CUSTOM_DIMENSION]'
    );

    archive_custom_dimension_sample($formattedName);
}

archiveCustomMetric

Archives a CustomMetric on a property.

Parameters
Name Description
name string

Required. The name of the CustomMetric to archive. Example format: properties/1234/customMetrics/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\ArchiveCustomMetricRequest;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CustomMetric to archive.
 *                              Example format: properties/1234/customMetrics/5678
 *                              Please see {@see AnalyticsAdminServiceClient::customMetricName()} for help formatting this field.
 */
function archive_custom_metric_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ArchiveCustomMetricRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveCustomMetric($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');

    archive_custom_metric_sample($formattedName);
}

batchCreateAccessBindings

Creates information about multiple access bindings to an account or property.

This method is transactional. If any AccessBinding cannot be created, none of the AccessBindings will be created.

Parameters
Name Description
parent string

Required. The account or property that owns the access bindings. The parent field in the CreateAccessBindingRequest messages must either be empty or match this field. Formats:

  • accounts/{account}
  • properties/{property}
requests array<Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest>

Required. The requests specifying the access bindings to create. A maximum of 1000 access bindings can be created in a batch.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\BatchCreateAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\BatchCreateAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchCreateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent         The account or property that owns the access bindings. The parent
 *                                        field in the CreateAccessBindingRequest messages must either be empty or
 *                                        match this field. Formats:
 *                                        - accounts/{account}
 *                                        - properties/{property}
 *                                        Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedRequestsParent Formats:
 *                                        - accounts/{account}
 *                                        - properties/{property}
 *                                        Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function batch_create_access_bindings_sample(
    string $formattedParent,
    string $formattedRequestsParent
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $requestsAccessBinding = new AccessBinding();
    $createAccessBindingRequest = (new CreateAccessBindingRequest())
        ->setParent($formattedRequestsParent)
        ->setAccessBinding($requestsAccessBinding);
    $requests = [$createAccessBindingRequest,];
    $request = (new BatchCreateAccessBindingsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchCreateAccessBindings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');
    $formattedRequestsParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    batch_create_access_bindings_sample($formattedParent, $formattedRequestsParent);
}

batchDeleteAccessBindings

Deletes information about multiple users' links to an account or property.

Parameters
Name Description
parent string

Required. The account or property that owns the access bindings. The parent of all provided values for the 'names' field in DeleteAccessBindingRequest messages must match this field. Formats:

  • accounts/{account}
  • properties/{property}
requests array<Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest>

Required. The requests specifying the access bindings to delete. A maximum of 1000 access bindings can be deleted in a batch.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\BatchDeleteAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The account or property that owns the access bindings. The parent
 *                                      of all provided values for the 'names' field in DeleteAccessBindingRequest
 *                                      messages must match this field. Formats:
 *                                      - accounts/{account}
 *                                      - properties/{property}
 *                                      Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedRequestsName Formats:
 *                                      - accounts/{account}/accessBindings/{accessBinding}
 *                                      - properties/{property}/accessBindings/{accessBinding}
 *                                      Please see {@see AnalyticsAdminServiceClient::accessBindingName()} for help formatting this field.
 */
function batch_delete_access_bindings_sample(
    string $formattedParent,
    string $formattedRequestsName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $deleteAccessBindingRequest = (new DeleteAccessBindingRequest())
        ->setName($formattedRequestsName);
    $requests = [$deleteAccessBindingRequest,];
    $request = (new BatchDeleteAccessBindingsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->batchDeleteAccessBindings($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');
    $formattedRequestsName = AnalyticsAdminServiceClient::accessBindingName(
        '[ACCOUNT]',
        '[ACCESS_BINDING]'
    );

    batch_delete_access_bindings_sample($formattedParent, $formattedRequestsName);
}

batchGetAccessBindings

Gets information about multiple access bindings to an account or property.

Parameters
Name Description
parent string

Required. The account or property that owns the access bindings. The parent of all provided values for the 'names' field must match this field. Formats:

  • accounts/{account}
  • properties/{property}
names string[]

Required. The names of the access bindings to retrieve. A maximum of 1000 access bindings can be retrieved in a batch. Formats:

  • accounts/{account}/accessBindings/{accessBinding}
  • properties/{property}/accessBindings/{accessBinding}
optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The account or property that owns the access bindings. The parent
 *                                      of all provided values for the 'names' field must match this field.
 *                                      Formats:
 *                                      - accounts/{account}
 *                                      - properties/{property}
 *                                      Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedNamesElement The names of the access bindings to retrieve.
 *                                      A maximum of 1000 access bindings can be retrieved in a batch.
 *                                      Formats:
 *                                      - accounts/{account}/accessBindings/{accessBinding}
 *                                      - properties/{property}/accessBindings/{accessBinding}
 *                                      Please see {@see AnalyticsAdminServiceClient::accessBindingName()} for help formatting this field.
 */
function batch_get_access_bindings_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchGetAccessBindingsRequest())
        ->setParent($formattedParent)
        ->setNames($formattedNames);

    // Call the API and handle any network failures.
    try {
        /** @var BatchGetAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchGetAccessBindings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');
    $formattedNamesElement = AnalyticsAdminServiceClient::accessBindingName(
        '[ACCOUNT]',
        '[ACCESS_BINDING]'
    );

    batch_get_access_bindings_sample($formattedParent, $formattedNamesElement);
}

batchUpdateAccessBindings

Updates information about multiple access bindings to an account or property.

Parameters
Name Description
parent string

Required. The account or property that owns the access bindings. The parent of all provided AccessBinding in UpdateAccessBindingRequest messages must match this field. Formats:

  • accounts/{account}
  • properties/{property}
requests array<Google\Analytics\Admin\V1alpha\UpdateAccessBindingRequest>

Required. The requests specifying the access bindings to update. A maximum of 1000 access bindings can be updated in a batch.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsRequest;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent The account or property that owns the access bindings. The parent
 *                                of all provided AccessBinding in UpdateAccessBindingRequest messages must
 *                                match this field.
 *                                Formats:
 *                                - accounts/{account}
 *                                - properties/{property}
 *                                Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function batch_update_access_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $requestsAccessBinding = new AccessBinding();
    $updateAccessBindingRequest = (new UpdateAccessBindingRequest())
        ->setAccessBinding($requestsAccessBinding);
    $requests = [$updateAccessBindingRequest,];
    $request = (new BatchUpdateAccessBindingsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchUpdateAccessBindings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    batch_update_access_bindings_sample($formattedParent);
}

cancelDisplayVideo360AdvertiserLinkProposal

Cancels a DisplayVideo360AdvertiserLinkProposal.

Cancelling can mean either:

  • Declining a proposal initiated from Display & Video 360
  • Withdrawing a proposal initiated from Google Analytics After being cancelled, a proposal will eventually be deleted automatically.
Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLinkProposal to cancel. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\CancelDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLinkProposal to cancel.
 *                              Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName()} for help formatting this field.
 */
function cancel_display_video360_advertiser_link_proposal_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new CancelDisplayVideo360AdvertiserLinkProposalRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->cancelDisplayVideo360AdvertiserLinkProposal($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]'
    );

    cancel_display_video360_advertiser_link_proposal_sample($formattedName);
}

createAccessBinding

Creates an access binding on an account or property.

Parameters
Name Description
parent string

Required. Formats:

  • accounts/{account}
  • properties/{property}
accessBinding Google\Analytics\Admin\V1alpha\AccessBinding

Required. The access binding to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Formats:
 *                                - accounts/{account}
 *                                - properties/{property}
 *                                Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function create_access_binding_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $accessBinding = new AccessBinding();
    $request = (new CreateAccessBindingRequest())
        ->setParent($formattedParent)
        ->setAccessBinding($accessBinding);

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->createAccessBinding($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    create_access_binding_sample($formattedParent);
}

Creates an AdSenseLink.

Parameters
Name Description
parent string

Required. The property for which to create an AdSense Link. Format: properties/{propertyId} Example: properties/1234

adsenseLink Google\Analytics\Admin\V1alpha\AdSenseLink

Required. The AdSense Link to create

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AdSenseLink
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateAdSenseLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent The property for which to create an AdSense Link.
 *                                Format: properties/{propertyId}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_ad_sense_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $adsenseLink = new AdSenseLink();
    $request = (new CreateAdSenseLinkRequest())
        ->setParent($formattedParent)
        ->setAdsenseLink($adsenseLink);

    // Call the API and handle any network failures.
    try {
        /** @var AdSenseLink $response */
        $response = $analyticsAdminServiceClient->createAdSenseLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_ad_sense_link_sample($formattedParent);
}

createAudience

Creates an Audience.

Parameters
Name Description
parent string

Required. Example format: properties/1234

audience Google\Analytics\Admin\V1alpha\Audience

Required. The audience to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause\AudienceClauseType;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateAudienceRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                 Example format: properties/1234
 *                                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $audienceDisplayName             The display name of the Audience.
 * @param string $audienceDescription             The description of the Audience.
 * @param int    $audienceMembershipDurationDays  Immutable. The duration a user should stay in an Audience. It
 *                                                cannot be set to more than 540 days.
 * @param int    $audienceFilterClausesClauseType Specifies whether this is an include or exclude filter clause.
 */
function create_audience_sample(
    string $formattedParent,
    string $audienceDisplayName,
    string $audienceDescription,
    int $audienceMembershipDurationDays,
    int $audienceFilterClausesClauseType
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $audienceFilterClause = (new AudienceFilterClause())
        ->setClauseType($audienceFilterClausesClauseType);
    $audienceFilterClauses = [$audienceFilterClause,];
    $audience = (new Audience())
        ->setDisplayName($audienceDisplayName)
        ->setDescription($audienceDescription)
        ->setMembershipDurationDays($audienceMembershipDurationDays)
        ->setFilterClauses($audienceFilterClauses);
    $request = (new CreateAudienceRequest())
        ->setParent($formattedParent)
        ->setAudience($audience);

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->createAudience($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $audienceDisplayName = '[DISPLAY_NAME]';
    $audienceDescription = '[DESCRIPTION]';
    $audienceMembershipDurationDays = 0;
    $audienceFilterClausesClauseType = AudienceClauseType::AUDIENCE_CLAUSE_TYPE_UNSPECIFIED;

    create_audience_sample(
        $formattedParent,
        $audienceDisplayName,
        $audienceDescription,
        $audienceMembershipDurationDays,
        $audienceFilterClausesClauseType
    );
}

createCalculatedMetric

Creates a CalculatedMetric.

Parameters
Name Description
parent string

Required. Format: properties/{property_id} Example: properties/1234

calculatedMetricId string

Required. The ID to use for the calculated metric which will become the final component of the calculated metric's resource name.

This value should be 1-80 characters and valid characters are /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique between all calculated metrics under a property. The calculated_metric_id is used when referencing this calculated metric from external APIs, for example, "calcMetric:{calculated_metric_id}".

calculatedMetric Google\Analytics\Admin\V1alpha\CalculatedMetric

Required. The CalculatedMetric to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CalculatedMetric
Example
use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\CalculatedMetric\MetricUnit;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent             Format: properties/{property_id}
 *                                            Example: properties/1234
 *                                            Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $calculatedMetricId          The ID to use for the calculated metric which will become the
 *                                            final component of the calculated metric's resource name.
 *
 *                                            This value should be 1-80 characters and valid characters are
 *                                            /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
 *                                            between all calculated metrics under a property. The calculated_metric_id
 *                                            is used when referencing this calculated metric from external APIs, for
 *                                            example, "calcMetric:{calculated_metric_id}".
 * @param string $calculatedMetricDisplayName Display name for this calculated metric as shown in the
 *                                            Google Analytics UI. Max length 82 characters.
 * @param int    $calculatedMetricMetricUnit  The type for the calculated metric's value.
 * @param string $calculatedMetricFormula     The calculated metric's definition. Maximum number of unique
 *                                            referenced custom metrics is 5. Formulas supports the following operations:
 *                                            + (addition),  - (subtraction), - (negative),  * (multiplication), /
 *                                            (division), () (parenthesis). Any valid real numbers are acceptable that
 *                                            fit in a Long (64bit integer) or a Double (64 bit floating point number).
 *                                            Example formula:
 *                                            "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
 */
function create_calculated_metric_sample(
    string $formattedParent,
    string $calculatedMetricId,
    string $calculatedMetricDisplayName,
    int $calculatedMetricMetricUnit,
    string $calculatedMetricFormula
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $calculatedMetric = (new CalculatedMetric())
        ->setDisplayName($calculatedMetricDisplayName)
        ->setMetricUnit($calculatedMetricMetricUnit)
        ->setFormula($calculatedMetricFormula);
    $request = (new CreateCalculatedMetricRequest())
        ->setParent($formattedParent)
        ->setCalculatedMetricId($calculatedMetricId)
        ->setCalculatedMetric($calculatedMetric);

    // Call the API and handle any network failures.
    try {
        /** @var CalculatedMetric $response */
        $response = $analyticsAdminServiceClient->createCalculatedMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $calculatedMetricId = '[CALCULATED_METRIC_ID]';
    $calculatedMetricDisplayName = '[DISPLAY_NAME]';
    $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
    $calculatedMetricFormula = '[FORMULA]';

    create_calculated_metric_sample(
        $formattedParent,
        $calculatedMetricId,
        $calculatedMetricDisplayName,
        $calculatedMetricMetricUnit,
        $calculatedMetricFormula
    );
}

createChannelGroup

Creates a ChannelGroup.

Parameters
Name Description
parent string

Required. The property for which to create a ChannelGroup. Example format: properties/1234

channelGroup Google\Analytics\Admin\V1alpha\ChannelGroup

Required. The ChannelGroup to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ChannelGroupFilterExpression;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateChannelGroupRequest;
use Google\Analytics\Admin\V1alpha\GroupingRule;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                     The property for which to create a ChannelGroup.
 *                                                    Example format: properties/1234
 *                                                    Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $channelGroupDisplayName             The display name of the Channel Group. Max length of 80
 *                                                    characters.
 * @param string $channelGroupGroupingRuleDisplayName Customer defined display name for the channel.
 */
function create_channel_group_sample(
    string $formattedParent,
    string $channelGroupDisplayName,
    string $channelGroupGroupingRuleDisplayName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $channelGroupGroupingRuleExpression = new ChannelGroupFilterExpression();
    $groupingRule = (new GroupingRule())
        ->setDisplayName($channelGroupGroupingRuleDisplayName)
        ->setExpression($channelGroupGroupingRuleExpression);
    $channelGroupGroupingRule = [$groupingRule,];
    $channelGroup = (new ChannelGroup())
        ->setDisplayName($channelGroupDisplayName)
        ->setGroupingRule($channelGroupGroupingRule);
    $request = (new CreateChannelGroupRequest())
        ->setParent($formattedParent)
        ->setChannelGroup($channelGroup);

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->createChannelGroup($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $channelGroupDisplayName = '[DISPLAY_NAME]';
    $channelGroupGroupingRuleDisplayName = '[DISPLAY_NAME]';

    create_channel_group_sample(
        $formattedParent,
        $channelGroupDisplayName,
        $channelGroupGroupingRuleDisplayName
    );
}

createConnectedSiteTag

Creates a connected site tag for a Universal Analytics property. You can create a maximum of 20 connected site tags per property.

Note: This API cannot be used on GA4 properties.

Parameters
Name Description
connectedSiteTag Google\Analytics\Admin\V1alpha\ConnectedSiteTag

Required. The tag to add to the Universal Analytics property

optionalArgs array

Optional.

↳ property string

The Universal Analytics property to create connected site tags for. This API does not support GA4 properties. Format: properties/{universalAnalyticsPropertyId} Example: properties/1234

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConnectedSiteTag;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagRequest;
use Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse;
use Google\ApiCore\ApiException;

/**
 * @param string $connectedSiteTagDisplayName User-provided display name for the connected site tag. Must be
 *                                            less than 256 characters.
 * @param string $connectedSiteTagTagId       "Tag ID to forward events to. Also known as the Measurement ID,
 *                                            or the "G-ID"  (For example: G-12345).
 */
function create_connected_site_tag_sample(
    string $connectedSiteTagDisplayName,
    string $connectedSiteTagTagId
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $connectedSiteTag = (new ConnectedSiteTag())
        ->setDisplayName($connectedSiteTagDisplayName)
        ->setTagId($connectedSiteTagTagId);
    $request = (new CreateConnectedSiteTagRequest())
        ->setConnectedSiteTag($connectedSiteTag);

    // Call the API and handle any network failures.
    try {
        /** @var CreateConnectedSiteTagResponse $response */
        $response = $analyticsAdminServiceClient->createConnectedSiteTag($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $connectedSiteTagDisplayName = '[DISPLAY_NAME]';
    $connectedSiteTagTagId = '[TAG_ID]';

    create_connected_site_tag_sample($connectedSiteTagDisplayName, $connectedSiteTagTagId);
}

createConversionEvent

Creates a conversion event with the specified attributes.

Parameters
Name Description
conversionEvent Google\Analytics\Admin\V1alpha\ConversionEvent

Required. The conversion event to create.

parent string

Required. The resource name of the parent property where this conversion event will be created. Format: properties/123

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ConversionEvent
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
use Google\Analytics\Admin\V1alpha\CreateConversionEventRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent The resource name of the parent property where this conversion
 *                                event will be created. Format: properties/123
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_conversion_event_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $conversionEvent = new ConversionEvent();
    $request = (new CreateConversionEventRequest())
        ->setConversionEvent($conversionEvent)
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var ConversionEvent $response */
        $response = $analyticsAdminServiceClient->createConversionEvent($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_conversion_event_sample($formattedParent);
}

createCustomDimension

Creates a CustomDimension.

Parameters
Name Description
parent string

Required. Example format: properties/1234

customDimension Google\Analytics\Admin\V1alpha\CustomDimension

Required. The CustomDimension to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateCustomDimensionRequest;
use Google\Analytics\Admin\V1alpha\CustomDimension;
use Google\Analytics\Admin\V1alpha\CustomDimension\DimensionScope;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent              Example format: properties/1234
 *                                             Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $customDimensionParameterName Immutable. Tagging parameter name for this custom dimension.
 *
 *                                             If this is a user-scoped dimension, then this is the user property name.
 *                                             If this is an event-scoped dimension, then this is the event parameter
 *                                             name.
 *
 *                                             If this is an item-scoped dimension, then this is the parameter
 *                                             name found in the eCommerce items array.
 *
 *                                             May only contain alphanumeric and underscore characters, starting with a
 *                                             letter. Max length of 24 characters for user-scoped dimensions, 40
 *                                             characters for event-scoped dimensions.
 * @param string $customDimensionDisplayName   Display name for this custom dimension as shown in the Analytics
 *                                             UI. Max length of 82 characters, alphanumeric plus space and underscore
 *                                             starting with a letter. Legacy system-generated display names may contain
 *                                             square brackets, but updates to this field will never permit square
 *                                             brackets.
 * @param int    $customDimensionScope         Immutable. The scope of this dimension.
 */
function create_custom_dimension_sample(
    string $formattedParent,
    string $customDimensionParameterName,
    string $customDimensionDisplayName,
    int $customDimensionScope
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $customDimension = (new CustomDimension())
        ->setParameterName($customDimensionParameterName)
        ->setDisplayName($customDimensionDisplayName)
        ->setScope($customDimensionScope);
    $request = (new CreateCustomDimensionRequest())
        ->setParent($formattedParent)
        ->setCustomDimension($customDimension);

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->createCustomDimension($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $customDimensionParameterName = '[PARAMETER_NAME]';
    $customDimensionDisplayName = '[DISPLAY_NAME]';
    $customDimensionScope = DimensionScope::DIMENSION_SCOPE_UNSPECIFIED;

    create_custom_dimension_sample(
        $formattedParent,
        $customDimensionParameterName,
        $customDimensionDisplayName,
        $customDimensionScope
    );
}

createCustomMetric

Creates a CustomMetric.

Parameters
Name Description
parent string

Required. Example format: properties/1234

customMetric Google\Analytics\Admin\V1alpha\CustomMetric

Required. The CustomMetric to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateCustomMetricRequest;
use Google\Analytics\Admin\V1alpha\CustomMetric;
use Google\Analytics\Admin\V1alpha\CustomMetric\MeasurementUnit;
use Google\Analytics\Admin\V1alpha\CustomMetric\MetricScope;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent             Example format: properties/1234
 *                                            Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $customMetricParameterName   Immutable. Tagging name for this custom metric.
 *
 *                                            If this is an event-scoped metric, then this is the event parameter
 *                                            name.
 *
 *                                            May only contain alphanumeric and underscore charactes, starting with a
 *                                            letter. Max length of 40 characters for event-scoped metrics.
 * @param string $customMetricDisplayName     Display name for this custom metric as shown in the Analytics UI.
 *                                            Max length of 82 characters, alphanumeric plus space and underscore
 *                                            starting with a letter. Legacy system-generated display names may contain
 *                                            square brackets, but updates to this field will never permit square
 *                                            brackets.
 * @param int    $customMetricMeasurementUnit The type for the custom metric's value.
 * @param int    $customMetricScope           Immutable. The scope of this custom metric.
 */
function create_custom_metric_sample(
    string $formattedParent,
    string $customMetricParameterName,
    string $customMetricDisplayName,
    int $customMetricMeasurementUnit,
    int $customMetricScope
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $customMetric = (new CustomMetric())
        ->setParameterName($customMetricParameterName)
        ->setDisplayName($customMetricDisplayName)
        ->setMeasurementUnit($customMetricMeasurementUnit)
        ->setScope($customMetricScope);
    $request = (new CreateCustomMetricRequest())
        ->setParent($formattedParent)
        ->setCustomMetric($customMetric);

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->createCustomMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $customMetricParameterName = '[PARAMETER_NAME]';
    $customMetricDisplayName = '[DISPLAY_NAME]';
    $customMetricMeasurementUnit = MeasurementUnit::MEASUREMENT_UNIT_UNSPECIFIED;
    $customMetricScope = MetricScope::METRIC_SCOPE_UNSPECIFIED;

    create_custom_metric_sample(
        $formattedParent,
        $customMetricParameterName,
        $customMetricDisplayName,
        $customMetricMeasurementUnit,
        $customMetricScope
    );
}

createDataStream

Creates a DataStream.

Parameters
Name Description
parent string

Required. Example format: properties/1234

dataStream Google\Analytics\Admin\V1alpha\DataStream

Required. The DataStream to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateDataStreamRequest;
use Google\Analytics\Admin\V1alpha\DataStream;
use Google\Analytics\Admin\V1alpha\DataStream\DataStreamType;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param int    $dataStreamType  Immutable. The type of this DataStream resource.
 */
function create_data_stream_sample(string $formattedParent, int $dataStreamType): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $dataStream = (new DataStream())
        ->setType($dataStreamType);
    $request = (new CreateDataStreamRequest())
        ->setParent($formattedParent)
        ->setDataStream($dataStream);

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->createDataStream($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $dataStreamType = DataStreamType::DATA_STREAM_TYPE_UNSPECIFIED;

    create_data_stream_sample($formattedParent, $dataStreamType);
}

Creates a DisplayVideo360AdvertiserLink.

This can only be utilized by users who have proper authorization both on the Google Analytics property and on the Display & Video 360 advertiser. Users who do not have access to the Display & Video 360 advertiser should instead seek to create a DisplayVideo360LinkProposal.

Parameters
Name Description
parent string

Required. Example format: properties/1234

displayVideo360AdvertiserLink Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink

Required. The DisplayVideo360AdvertiserLink to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateDisplayVideo360AdvertiserLinkRequest;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_display_video360_advertiser_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $displayVideo360AdvertiserLink = new DisplayVideo360AdvertiserLink();
    $request = (new CreateDisplayVideo360AdvertiserLinkRequest())
        ->setParent($formattedParent)
        ->setDisplayVideo360AdvertiserLink($displayVideo360AdvertiserLink);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->createDisplayVideo360AdvertiserLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_display_video360_advertiser_link_sample($formattedParent);
}

createDisplayVideo360AdvertiserLinkProposal

Creates a DisplayVideo360AdvertiserLinkProposal.

Parameters
Name Description
parent string

Required. Example format: properties/1234

displayVideo360AdvertiserLinkProposal Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal

Required. The DisplayVideo360AdvertiserLinkProposal to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateDisplayVideo360AdvertiserLinkProposalRequest;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_display_video360_advertiser_link_proposal_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $displayVideo360AdvertiserLinkProposal = new DisplayVideo360AdvertiserLinkProposal();
    $request = (new CreateDisplayVideo360AdvertiserLinkProposalRequest())
        ->setParent($formattedParent)
        ->setDisplayVideo360AdvertiserLinkProposal($displayVideo360AdvertiserLinkProposal);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->createDisplayVideo360AdvertiserLinkProposal($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_display_video360_advertiser_link_proposal_sample($formattedParent);
}

createEventCreateRule

Creates an EventCreateRule.

Parameters
Name Description
parent string

Required. Example format: properties/123/dataStreams/456

eventCreateRule Google\Analytics\Admin\V1alpha\EventCreateRule

Required. The EventCreateRule to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateEventCreateRuleRequest;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
use Google\Analytics\Admin\V1alpha\MatchingCondition;
use Google\Analytics\Admin\V1alpha\MatchingCondition\ComparisonType;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                              Example format: properties/123/dataStreams/456
 *                                                             Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 * @param string $eventCreateRuleDestinationEvent              The name of the new event to be created.
 *
 *                                                             This value must:
 *                                                             * be less than 40 characters
 *                                                             * consist only of letters, digits or _ (underscores)
 *                                                             * start with a letter
 * @param string $eventCreateRuleEventConditionsField          The name of the field that is compared against for the condition.
 *                                                             If 'event_name' is specified this condition will apply to the name of the
 *                                                             event.  Otherwise the condition will apply to a parameter with the
 *                                                             specified name.
 *
 *                                                             This value cannot contain spaces.
 * @param int    $eventCreateRuleEventConditionsComparisonType The type of comparison to be applied to the value.
 * @param string $eventCreateRuleEventConditionsValue          The value being compared against for this condition.  The runtime
 *                                                             implementation may perform type coercion of this value to evaluate this
 *                                                             condition based on the type of the parameter value.
 */
function create_event_create_rule_sample(
    string $formattedParent,
    string $eventCreateRuleDestinationEvent,
    string $eventCreateRuleEventConditionsField,
    int $eventCreateRuleEventConditionsComparisonType,
    string $eventCreateRuleEventConditionsValue
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $matchingCondition = (new MatchingCondition())
        ->setField($eventCreateRuleEventConditionsField)
        ->setComparisonType($eventCreateRuleEventConditionsComparisonType)
        ->setValue($eventCreateRuleEventConditionsValue);
    $eventCreateRuleEventConditions = [$matchingCondition,];
    $eventCreateRule = (new EventCreateRule())
        ->setDestinationEvent($eventCreateRuleDestinationEvent)
        ->setEventConditions($eventCreateRuleEventConditions);
    $request = (new CreateEventCreateRuleRequest())
        ->setParent($formattedParent)
        ->setEventCreateRule($eventCreateRule);

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->createEventCreateRule($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');
    $eventCreateRuleDestinationEvent = '[DESTINATION_EVENT]';
    $eventCreateRuleEventConditionsField = '[FIELD]';
    $eventCreateRuleEventConditionsComparisonType = ComparisonType::COMPARISON_TYPE_UNSPECIFIED;
    $eventCreateRuleEventConditionsValue = '[VALUE]';

    create_event_create_rule_sample(
        $formattedParent,
        $eventCreateRuleDestinationEvent,
        $eventCreateRuleEventConditionsField,
        $eventCreateRuleEventConditionsComparisonType,
        $eventCreateRuleEventConditionsValue
    );
}

createExpandedDataSet

Creates a ExpandedDataSet.

Parameters
Name Description
parent string

Required. Example format: properties/1234

expandedDataSet Google\Analytics\Admin\V1alpha\ExpandedDataSet

Required. The ExpandedDataSet to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateExpandedDataSetRequest;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent            Example format: properties/1234
 *                                           Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $expandedDataSetDisplayName The display name of the ExpandedDataSet.
 *                                           Max 200 chars.
 */
function create_expanded_data_set_sample(
    string $formattedParent,
    string $expandedDataSetDisplayName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $expandedDataSet = (new ExpandedDataSet())
        ->setDisplayName($expandedDataSetDisplayName);
    $request = (new CreateExpandedDataSetRequest())
        ->setParent($formattedParent)
        ->setExpandedDataSet($expandedDataSet);

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->createExpandedDataSet($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $expandedDataSetDisplayName = '[DISPLAY_NAME]';

    create_expanded_data_set_sample($formattedParent, $expandedDataSetDisplayName);
}

Creates a FirebaseLink.

Properties can have at most one FirebaseLink.

Parameters
Name Description
parent string

Required. Format: properties/{property_id} Example: properties/1234

firebaseLink Google\Analytics\Admin\V1alpha\FirebaseLink

Required. The Firebase link to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\FirebaseLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateFirebaseLinkRequest;
use Google\Analytics\Admin\V1alpha\FirebaseLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Format: properties/{property_id}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_firebase_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $firebaseLink = new FirebaseLink();
    $request = (new CreateFirebaseLinkRequest())
        ->setParent($formattedParent)
        ->setFirebaseLink($firebaseLink);

    // Call the API and handle any network failures.
    try {
        /** @var FirebaseLink $response */
        $response = $analyticsAdminServiceClient->createFirebaseLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_firebase_link_sample($formattedParent);
}

Creates a GoogleAdsLink.

Parameters
Name Description
parent string

Required. Example format: properties/1234

googleAdsLink Google\Analytics\Admin\V1alpha\GoogleAdsLink

Required. The GoogleAdsLink to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\GoogleAdsLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateGoogleAdsLinkRequest;
use Google\Analytics\Admin\V1alpha\GoogleAdsLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_google_ads_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $googleAdsLink = new GoogleAdsLink();
    $request = (new CreateGoogleAdsLinkRequest())
        ->setParent($formattedParent)
        ->setGoogleAdsLink($googleAdsLink);

    // Call the API and handle any network failures.
    try {
        /** @var GoogleAdsLink $response */
        $response = $analyticsAdminServiceClient->createGoogleAdsLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_google_ads_link_sample($formattedParent);
}

createMeasurementProtocolSecret

Creates a measurement protocol secret.

Parameters
Name Description
parent string

Required. The parent resource where this secret will be created. Format: properties/{property}/dataStreams/{dataStream}

measurementProtocolSecret Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret

Required. The measurement protocol secret to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateMeasurementProtocolSecretRequest;
use Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                      The parent resource where this secret will be created.
 *                                                     Format: properties/{property}/dataStreams/{dataStream}
 *                                                     Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 * @param string $measurementProtocolSecretDisplayName Human-readable display name for this secret.
 */
function create_measurement_protocol_secret_sample(
    string $formattedParent,
    string $measurementProtocolSecretDisplayName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $measurementProtocolSecret = (new MeasurementProtocolSecret())
        ->setDisplayName($measurementProtocolSecretDisplayName);
    $request = (new CreateMeasurementProtocolSecretRequest())
        ->setParent($formattedParent)
        ->setMeasurementProtocolSecret($measurementProtocolSecret);

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->createMeasurementProtocolSecret($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');
    $measurementProtocolSecretDisplayName = '[DISPLAY_NAME]';

    create_measurement_protocol_secret_sample($formattedParent, $measurementProtocolSecretDisplayName);
}

createProperty

Creates an "GA4" property with the specified location and attributes.

Parameters
Name Description
property Google\Analytics\Admin\V1alpha\Property

Required. The property to create. Note: the supplied property must specify its parent.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreatePropertyRequest;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;

/**
 * @param string $propertyDisplayName Human-readable display name for this property.
 *
 *                                    The max allowed display name length is 100 UTF-16 code units.
 * @param string $propertyTimeZone    Reporting Time Zone, used as the day boundary for reports,
 *                                    regardless of where the data originates. If the time zone honors DST,
 *                                    Analytics will automatically adjust for the changes.
 *
 *                                    NOTE: Changing the time zone only affects data going forward, and is not
 *                                    applied retroactively.
 *
 *                                    Format: https://www.iana.org/time-zones
 *                                    Example: "America/Los_Angeles"
 */
function create_property_sample(string $propertyDisplayName, string $propertyTimeZone): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $property = (new Property())
        ->setDisplayName($propertyDisplayName)
        ->setTimeZone($propertyTimeZone);
    $request = (new CreatePropertyRequest())
        ->setProperty($property);

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->createProperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $propertyDisplayName = '[DISPLAY_NAME]';
    $propertyTimeZone = '[TIME_ZONE]';

    create_property_sample($propertyDisplayName, $propertyTimeZone);
}

createRollupProperty

Create a roll-up property and all roll-up property source links.

Parameters
Name Description
rollupProperty Google\Analytics\Admin\V1alpha\Property

Required. The roll-up property to create.

optionalArgs array

Optional.

↳ sourceProperties string[]

Optional. The resource names of properties that will be sources to the created roll-up property.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CreateRollupPropertyResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateRollupPropertyRequest;
use Google\Analytics\Admin\V1alpha\CreateRollupPropertyResponse;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;

/**
 * @param string $rollupPropertyDisplayName Human-readable display name for this property.
 *
 *                                          The max allowed display name length is 100 UTF-16 code units.
 * @param string $rollupPropertyTimeZone    Reporting Time Zone, used as the day boundary for reports,
 *                                          regardless of where the data originates. If the time zone honors DST,
 *                                          Analytics will automatically adjust for the changes.
 *
 *                                          NOTE: Changing the time zone only affects data going forward, and is not
 *                                          applied retroactively.
 *
 *                                          Format: https://www.iana.org/time-zones
 *                                          Example: "America/Los_Angeles"
 */
function create_rollup_property_sample(
    string $rollupPropertyDisplayName,
    string $rollupPropertyTimeZone
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $rollupProperty = (new Property())
        ->setDisplayName($rollupPropertyDisplayName)
        ->setTimeZone($rollupPropertyTimeZone);
    $request = (new CreateRollupPropertyRequest())
        ->setRollupProperty($rollupProperty);

    // Call the API and handle any network failures.
    try {
        /** @var CreateRollupPropertyResponse $response */
        $response = $analyticsAdminServiceClient->createRollupProperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $rollupPropertyDisplayName = '[DISPLAY_NAME]';
    $rollupPropertyTimeZone = '[TIME_ZONE]';

    create_rollup_property_sample($rollupPropertyDisplayName, $rollupPropertyTimeZone);
}

Creates a roll-up property source link.

Only roll-up properties can have source links, so this method will throw an error if used on other types of properties.

Parameters
Name Description
parent string

Required. Format: properties/{property_id} Example: properties/1234

rollupPropertySourceLink Google\Analytics\Admin\V1alpha\RollupPropertySourceLink

Required. The roll-up property source link to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\RollupPropertySourceLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateRollupPropertySourceLinkRequest;
use Google\Analytics\Admin\V1alpha\RollupPropertySourceLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Format: properties/{property_id}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_rollup_property_source_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $rollupPropertySourceLink = new RollupPropertySourceLink();
    $request = (new CreateRollupPropertySourceLinkRequest())
        ->setParent($formattedParent)
        ->setRollupPropertySourceLink($rollupPropertySourceLink);

    // Call the API and handle any network failures.
    try {
        /** @var RollupPropertySourceLink $response */
        $response = $analyticsAdminServiceClient->createRollupPropertySourceLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_rollup_property_source_link_sample($formattedParent);
}

createSKAdNetworkConversionValueSchema

Creates a SKAdNetworkConversionValueSchema.

Parameters
Name Description
parent string

Required. The parent resource where this schema will be created. Format: properties/{property}/dataStreams/{dataStream}

skadnetworkConversionValueSchema Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema

Required. SKAdNetwork conversion value schema to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateSKAdNetworkConversionValueSchemaRequest;
use Google\Analytics\Admin\V1alpha\PostbackWindow;
use Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent The parent resource where this schema will be created.
 *                                Format: properties/{property}/dataStreams/{dataStream}
 *                                Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function create_sk_ad_network_conversion_value_schema_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $skadnetworkConversionValueSchemaPostbackWindowOne = new PostbackWindow();
    $skadnetworkConversionValueSchema = (new SKAdNetworkConversionValueSchema())
        ->setPostbackWindowOne($skadnetworkConversionValueSchemaPostbackWindowOne);
    $request = (new CreateSKAdNetworkConversionValueSchemaRequest())
        ->setParent($formattedParent)
        ->setSkadnetworkConversionValueSchema($skadnetworkConversionValueSchema);

    // Call the API and handle any network failures.
    try {
        /** @var SKAdNetworkConversionValueSchema $response */
        $response = $analyticsAdminServiceClient->createSKAdNetworkConversionValueSchema($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    create_sk_ad_network_conversion_value_schema_sample($formattedParent);
}

Creates a SearchAds360Link.

Parameters
Name Description
parent string

Required. Example format: properties/1234

searchAds360Link Google\Analytics\Admin\V1alpha\SearchAds360Link

Required. The SearchAds360Link to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateSearchAds360LinkRequest;
use Google\Analytics\Admin\V1alpha\SearchAds360Link;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function create_search_ads360_link_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $searchAds360Link = new SearchAds360Link();
    $request = (new CreateSearchAds360LinkRequest())
        ->setParent($formattedParent)
        ->setSearchAds360Link($searchAds360Link);

    // Call the API and handle any network failures.
    try {
        /** @var SearchAds360Link $response */
        $response = $analyticsAdminServiceClient->createSearchAds360Link($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    create_search_ads360_link_sample($formattedParent);
}

createSubproperty

Create a subproperty and a subproperty event filter that applies to the created subproperty.

Parameters
Name Description
parent string

Required. The ordinary property for which to create a subproperty. Format: properties/property_id Example: properties/123

subproperty Google\Analytics\Admin\V1alpha\Property

Required. The subproperty to create.

optionalArgs array

Optional.

↳ subpropertyEventFilter SubpropertyEventFilter

Optional. The subproperty event filter to create on an ordinary property.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CreateSubpropertyResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateSubpropertyRequest;
use Google\Analytics\Admin\V1alpha\CreateSubpropertyResponse;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent        The ordinary property for which to create a subproperty.
 *                                       Format: properties/property_id
 *                                       Example: properties/123
 *                                       Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param string $subpropertyDisplayName Human-readable display name for this property.
 *
 *                                       The max allowed display name length is 100 UTF-16 code units.
 * @param string $subpropertyTimeZone    Reporting Time Zone, used as the day boundary for reports,
 *                                       regardless of where the data originates. If the time zone honors DST,
 *                                       Analytics will automatically adjust for the changes.
 *
 *                                       NOTE: Changing the time zone only affects data going forward, and is not
 *                                       applied retroactively.
 *
 *                                       Format: https://www.iana.org/time-zones
 *                                       Example: "America/Los_Angeles"
 */
function create_subproperty_sample(
    string $formattedParent,
    string $subpropertyDisplayName,
    string $subpropertyTimeZone
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $subproperty = (new Property())
        ->setDisplayName($subpropertyDisplayName)
        ->setTimeZone($subpropertyTimeZone);
    $request = (new CreateSubpropertyRequest())
        ->setParent($formattedParent)
        ->setSubproperty($subproperty);

    // Call the API and handle any network failures.
    try {
        /** @var CreateSubpropertyResponse $response */
        $response = $analyticsAdminServiceClient->createSubproperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $subpropertyDisplayName = '[DISPLAY_NAME]';
    $subpropertyTimeZone = '[TIME_ZONE]';

    create_subproperty_sample($formattedParent, $subpropertyDisplayName, $subpropertyTimeZone);
}

createSubpropertyEventFilter

Creates a subproperty Event Filter.

Parameters
Name Description
parent string

Required. The ordinary property for which to create a subproperty event filter. Format: properties/property_id Example: properties/123

subpropertyEventFilter Google\Analytics\Admin\V1alpha\SubpropertyEventFilter

Required. The subproperty event filter to create.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SubpropertyEventFilter
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CreateSubpropertyEventFilterRequest;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilter;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterClause;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterClause\FilterClauseType;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterExpression;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                                     The ordinary property for which to create a subproperty event
 *                                                                    filter. Format: properties/property_id Example: properties/123
 *                                                                    Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 * @param int    $subpropertyEventFilterFilterClausesFilterClauseType The type for the filter clause.
 */
function create_subproperty_event_filter_sample(
    string $formattedParent,
    int $subpropertyEventFilterFilterClausesFilterClauseType
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $subpropertyEventFilterFilterClausesFilterExpression = new SubpropertyEventFilterExpression();
    $subpropertyEventFilterClause = (new SubpropertyEventFilterClause())
        ->setFilterClauseType($subpropertyEventFilterFilterClausesFilterClauseType)
        ->setFilterExpression($subpropertyEventFilterFilterClausesFilterExpression);
    $subpropertyEventFilterFilterClauses = [$subpropertyEventFilterClause,];
    $subpropertyEventFilter = (new SubpropertyEventFilter())
        ->setFilterClauses($subpropertyEventFilterFilterClauses);
    $request = (new CreateSubpropertyEventFilterRequest())
        ->setParent($formattedParent)
        ->setSubpropertyEventFilter($subpropertyEventFilter);

    // Call the API and handle any network failures.
    try {
        /** @var SubpropertyEventFilter $response */
        $response = $analyticsAdminServiceClient->createSubpropertyEventFilter($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
    $subpropertyEventFilterFilterClausesFilterClauseType = FilterClauseType::FILTER_CLAUSE_TYPE_UNSPECIFIED;

    create_subproperty_event_filter_sample(
        $formattedParent,
        $subpropertyEventFilterFilterClausesFilterClauseType
    );
}

deleteAccessBinding

Deletes an access binding on an account or property.

Parameters
Name Description
name string

Required. Formats:

  • accounts/{account}/accessBindings/{accessBinding}
  • properties/{property}/accessBindings/{accessBinding}
optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Formats:
 *                              - accounts/{account}/accessBindings/{accessBinding}
 *                              - properties/{property}/accessBindings/{accessBinding}
 *                              Please see {@see AnalyticsAdminServiceClient::accessBindingName()} for help formatting this field.
 */
function delete_access_binding_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteAccessBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAccessBinding($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::accessBindingName('[ACCOUNT]', '[ACCESS_BINDING]');

    delete_access_binding_sample($formattedName);
}

deleteAccount

Marks target Account as soft-deleted (ie: "trashed") and returns it.

This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI.

If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, AccessBindings) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found.

Parameters
Name Description
name string

Required. The name of the Account to soft-delete. Format: accounts/{account} Example: "accounts/100"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteAccountRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the Account to soft-delete.
 *                              Format: accounts/{account}
 *                              Example: "accounts/100"
 *                              Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function delete_account_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteAccountRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAccount($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    delete_account_sample($formattedName);
}

Deletes an AdSenseLink.

Parameters
Name Description
name string

Required. Unique identifier for the AdSense Link to be deleted. Format: properties/{propertyId}/adSenseLinks/{linkId} Example: properties/1234/adSenseLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteAdSenseLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Unique identifier for the AdSense Link to be deleted.
 *                              Format: properties/{propertyId}/adSenseLinks/{linkId}
 *                              Example: properties/1234/adSenseLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::adSenseLinkName()} for help formatting this field.
 */
function delete_ad_sense_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteAdSenseLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAdSenseLink($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::adSenseLinkName('[PROPERTY]', '[ADSENSE_LINK]');

    delete_ad_sense_link_sample($formattedName);
}

deleteCalculatedMetric

Deletes a CalculatedMetric on a property.

Parameters
Name Description
name string

Required. The name of the CalculatedMetric to delete. Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id} Example: properties/1234/calculatedMetrics/Metric01

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteCalculatedMetricRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CalculatedMetric to delete.
 *                              Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
 *                              Example: properties/1234/calculatedMetrics/Metric01
 *                              Please see {@see AnalyticsAdminServiceClient::calculatedMetricName()} for help formatting this field.
 */
function delete_calculated_metric_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteCalculatedMetricRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteCalculatedMetric($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::calculatedMetricName(
        '[PROPERTY]',
        '[CALCULATED_METRIC]'
    );

    delete_calculated_metric_sample($formattedName);
}

deleteChannelGroup

Deletes a ChannelGroup on a property.

Parameters
Name Description
name string

Required. The ChannelGroup to delete. Example format: properties/1234/channelGroups/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteChannelGroupRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The ChannelGroup to delete.
 *                              Example format: properties/1234/channelGroups/5678
 *                              Please see {@see AnalyticsAdminServiceClient::channelGroupName()} for help formatting this field.
 */
function delete_channel_group_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteChannelGroupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteChannelGroup($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::channelGroupName('[PROPERTY]', '[CHANNEL_GROUP]');

    delete_channel_group_sample($formattedName);
}

deleteConnectedSiteTag

Deletes a connected site tag for a Universal Analytics property.

Note: this has no effect on GA4 properties.

Parameters
Name Description
optionalArgs array

Optional.

↳ property string

The Universal Analytics property to delete connected site tags for. This API does not support GA4 properties. Format: properties/{universalAnalyticsPropertyId} Example: properties/1234

↳ tagId string

Tag ID to forward events to. Also known as the Measurement ID, or the "G-ID" (For example: G-12345).

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteConnectedSiteTagRequest;
use Google\ApiCore\ApiException;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function delete_connected_site_tag_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new DeleteConnectedSiteTagRequest();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteConnectedSiteTag($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

deleteConversionEvent

Deletes a conversion event in a property.

Parameters
Name Description
name string

Required. The resource name of the conversion event to delete. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteConversionEventRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the conversion event to delete.
 *                              Format: properties/{property}/conversionEvents/{conversion_event}
 *                              Example: "properties/123/conversionEvents/456"
 *                              Please see {@see AnalyticsAdminServiceClient::conversionEventName()} for help formatting this field.
 */
function delete_conversion_event_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteConversionEventRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteConversionEvent($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::conversionEventName(
        '[PROPERTY]',
        '[CONVERSION_EVENT]'
    );

    delete_conversion_event_sample($formattedName);
}

deleteDataStream

Deletes a DataStream on a property.

Parameters
Name Description
name string

Required. The name of the DataStream to delete. Example format: properties/1234/dataStreams/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteDataStreamRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DataStream to delete.
 *                              Example format: properties/1234/dataStreams/5678
 *                              Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function delete_data_stream_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteDataStreamRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDataStream($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    delete_data_stream_sample($formattedName);
}

Deletes a DisplayVideo360AdvertiserLink on a property.

Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLink to delete. Example format: properties/1234/displayVideo360AdvertiserLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteDisplayVideo360AdvertiserLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLink to delete.
 *                              Example format: properties/1234/displayVideo360AdvertiserLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkName()} for help formatting this field.
 */
function delete_display_video360_advertiser_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteDisplayVideo360AdvertiserLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDisplayVideo360AdvertiserLink($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK]'
    );

    delete_display_video360_advertiser_link_sample($formattedName);
}

deleteDisplayVideo360AdvertiserLinkProposal

Deletes a DisplayVideo360AdvertiserLinkProposal on a property.

This can only be used on cancelled proposals.

Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLinkProposal to delete. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteDisplayVideo360AdvertiserLinkProposalRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLinkProposal to delete.
 *                              Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName()} for help formatting this field.
 */
function delete_display_video360_advertiser_link_proposal_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteDisplayVideo360AdvertiserLinkProposalRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDisplayVideo360AdvertiserLinkProposal($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]'
    );

    delete_display_video360_advertiser_link_proposal_sample($formattedName);
}

deleteEventCreateRule

Deletes an EventCreateRule.

Parameters
Name Description
name string

Required. Example format: properties/123/dataStreams/456/eventCreateRules/789

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteEventCreateRuleRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Example format:
 *                              properties/123/dataStreams/456/eventCreateRules/789
 *                              Please see {@see AnalyticsAdminServiceClient::eventCreateRuleName()} for help formatting this field.
 */
function delete_event_create_rule_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteEventCreateRuleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteEventCreateRule($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::eventCreateRuleName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[EVENT_CREATE_RULE]'
    );

    delete_event_create_rule_sample($formattedName);
}

deleteExpandedDataSet

Deletes a ExpandedDataSet on a property.

Parameters
Name Description
name string

Required. Example format: properties/1234/expandedDataSets/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteExpandedDataSetRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Example format: properties/1234/expandedDataSets/5678
 *                              Please see {@see AnalyticsAdminServiceClient::expandedDataSetName()} for help formatting this field.
 */
function delete_expanded_data_set_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteExpandedDataSetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteExpandedDataSet($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::expandedDataSetName(
        '[PROPERTY]',
        '[EXPANDED_DATA_SET]'
    );

    delete_expanded_data_set_sample($formattedName);
}

Deletes a FirebaseLink on a property

Parameters
Name Description
name string

Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} Example: properties/1234/firebaseLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteFirebaseLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Format: properties/{property_id}/firebaseLinks/{firebase_link_id}
 *                              Example: properties/1234/firebaseLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::firebaseLinkName()} for help formatting this field.
 */
function delete_firebase_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteFirebaseLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteFirebaseLink($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::firebaseLinkName('[PROPERTY]', '[FIREBASE_LINK]');

    delete_firebase_link_sample($formattedName);
}

Deletes a GoogleAdsLink on a property

Parameters
Name Description
name string

Required. Example format: properties/1234/googleAdsLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteGoogleAdsLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Example format: properties/1234/googleAdsLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::googleAdsLinkName()} for help formatting this field.
 */
function delete_google_ads_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteGoogleAdsLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteGoogleAdsLink($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::googleAdsLinkName('[PROPERTY]', '[GOOGLE_ADS_LINK]');

    delete_google_ads_link_sample($formattedName);
}

deleteMeasurementProtocolSecret

Deletes target MeasurementProtocolSecret.

Parameters
Name Description
name string

Required. The name of the MeasurementProtocolSecret to delete. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteMeasurementProtocolSecretRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the MeasurementProtocolSecret to delete.
 *                              Format:
 *                              properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
 *                              Please see {@see AnalyticsAdminServiceClient::measurementProtocolSecretName()} for help formatting this field.
 */
function delete_measurement_protocol_secret_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteMeasurementProtocolSecretRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteMeasurementProtocolSecret($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::measurementProtocolSecretName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[MEASUREMENT_PROTOCOL_SECRET]'
    );

    delete_measurement_protocol_secret_sample($formattedName);
}

deleteProperty

Marks target Property as soft-deleted (ie: "trashed") and returns it.

This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI.

If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, AccessBindings) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found, or is not a GA4 Property.

Parameters
Name Description
name string

Required. The name of the Property to soft-delete. Format: properties/{property_id} Example: "properties/1000"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeletePropertyRequest;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the Property to soft-delete.
 *                              Format: properties/{property_id}
 *                              Example: "properties/1000"
 *                              Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function delete_property_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeletePropertyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->deleteProperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    delete_property_sample($formattedName);
}

Deletes a roll-up property source link.

Only roll-up properties can have source links, so this method will throw an error if used on other types of properties.

Parameters
Name Description
name string

Required. Format: properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} Example: properties/1234/rollupPropertySourceLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteRollupPropertySourceLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Format:
 *                              properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id}
 *                              Example: properties/1234/rollupPropertySourceLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::rollupPropertySourceLinkName()} for help formatting this field.
 */
function delete_rollup_property_source_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteRollupPropertySourceLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteRollupPropertySourceLink($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::rollupPropertySourceLinkName(
        '[PROPERTY]',
        '[ROLLUP_PROPERTY_SOURCE_LINK]'
    );

    delete_rollup_property_source_link_sample($formattedName);
}

deleteSKAdNetworkConversionValueSchema

Deletes target SKAdNetworkConversionValueSchema.

Parameters
Name Description
name string

Required. The name of the SKAdNetworkConversionValueSchema to delete. Format: properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteSKAdNetworkConversionValueSchemaRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the SKAdNetworkConversionValueSchema to delete.
 *                              Format:
 *                              properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}
 *                              Please see {@see AnalyticsAdminServiceClient::sKAdNetworkConversionValueSchemaName()} for help formatting this field.
 */
function delete_sk_ad_network_conversion_value_schema_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteSKAdNetworkConversionValueSchemaRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteSKAdNetworkConversionValueSchema($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::sKAdNetworkConversionValueSchemaName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[SKADNETWORK_CONVERSION_VALUE_SCHEMA]'
    );

    delete_sk_ad_network_conversion_value_schema_sample($formattedName);
}

Deletes a SearchAds360Link on a property.

Parameters
Name Description
name string

Required. The name of the SearchAds360Link to delete. Example format: properties/1234/SearchAds360Links/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteSearchAds360LinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the SearchAds360Link to delete.
 *                              Example format: properties/1234/SearchAds360Links/5678
 *                              Please see {@see AnalyticsAdminServiceClient::searchAds360LinkName()} for help formatting this field.
 */
function delete_search_ads360_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteSearchAds360LinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteSearchAds360Link($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::searchAds360LinkName(
        '[PROPERTY]',
        '[SEARCH_ADS_360_LINK]'
    );

    delete_search_ads360_link_sample($formattedName);
}

deleteSubpropertyEventFilter

Deletes a subproperty event filter.

Parameters
Name Description
name string

Required. Resource name of the subproperty event filter to delete. Format: properties/property_id/subpropertyEventFilters/subproperty_event_filter Example: properties/123/subpropertyEventFilters/456

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteSubpropertyEventFilterRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Resource name of the subproperty event filter to delete.
 *                              Format:
 *                              properties/property_id/subpropertyEventFilters/subproperty_event_filter
 *                              Example: properties/123/subpropertyEventFilters/456
 *                              Please see {@see AnalyticsAdminServiceClient::subpropertyEventFilterName()} for help formatting this field.
 */
function delete_subproperty_event_filter_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new DeleteSubpropertyEventFilterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteSubpropertyEventFilter($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::subpropertyEventFilterName(
        '[PROPERTY]',
        '[SUB_PROPERTY_EVENT_FILTER]'
    );

    delete_subproperty_event_filter_sample($formattedName);
}

fetchAutomatedGa4ConfigurationOptOut

Fetches the opt out status for the automated GA4 setup process for a UA property.

Note: this has no effect on GA4 property.

Parameters
Name Description
property string

Required. The UA property to get the opt out status. Note this request uses the internal property ID, not the tracking ID of the form UA-XXXXXX-YY. Format: properties/{internalWebPropertyId} Example: properties/1234

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\FetchAutomatedGa4ConfigurationOptOutResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\FetchAutomatedGa4ConfigurationOptOutRequest;
use Google\Analytics\Admin\V1alpha\FetchAutomatedGa4ConfigurationOptOutResponse;
use Google\ApiCore\ApiException;

/**
 * @param string $property The UA property to get the opt out status. Note this request uses
 *                         the internal property ID, not the tracking ID of the form UA-XXXXXX-YY.
 *                         Format: properties/{internalWebPropertyId}
 *                         Example: properties/1234
 */
function fetch_automated_ga4_configuration_opt_out_sample(string $property): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new FetchAutomatedGa4ConfigurationOptOutRequest())
        ->setProperty($property);

    // Call the API and handle any network failures.
    try {
        /** @var FetchAutomatedGa4ConfigurationOptOutResponse $response */
        $response = $analyticsAdminServiceClient->fetchAutomatedGa4ConfigurationOptOut($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $property = '[PROPERTY]';

    fetch_automated_ga4_configuration_opt_out_sample($property);
}

fetchConnectedGa4Property

Given a specified UA property, looks up the GA4 property connected to it.

Note: this cannot be used with GA4 properties.

Parameters
Name Description
property string

Required. The UA property for which to look up the connected GA4 property. Note this request uses the internal property ID, not the tracking ID of the form UA-XXXXXX-YY. Format: properties/{internal_web_property_id} Example: properties/1234

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\FetchConnectedGa4PropertyResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\FetchConnectedGa4PropertyRequest;
use Google\Analytics\Admin\V1alpha\FetchConnectedGa4PropertyResponse;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedProperty The UA property for which to look up the connected GA4 property.
 *                                  Note this request uses the
 *                                  internal property ID, not the tracking ID of the form UA-XXXXXX-YY.
 *                                  Format: properties/{internal_web_property_id}
 *                                  Example: properties/1234
 *                                  Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function fetch_connected_ga4_property_sample(string $formattedProperty): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new FetchConnectedGa4PropertyRequest())
        ->setProperty($formattedProperty);

    // Call the API and handle any network failures.
    try {
        /** @var FetchConnectedGa4PropertyResponse $response */
        $response = $analyticsAdminServiceClient->fetchConnectedGa4Property($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedProperty = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    fetch_connected_ga4_property_sample($formattedProperty);
}

getAccessBinding

Gets information about an access binding.

Parameters
Name Description
name string

Required. The name of the access binding to retrieve. Formats:

  • accounts/{account}/accessBindings/{accessBinding}
  • properties/{property}/accessBindings/{accessBinding}
optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the access binding to retrieve.
 *                              Formats:
 *                              - accounts/{account}/accessBindings/{accessBinding}
 *                              - properties/{property}/accessBindings/{accessBinding}
 *                              Please see {@see AnalyticsAdminServiceClient::accessBindingName()} for help formatting this field.
 */
function get_access_binding_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetAccessBindingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->getAccessBinding($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::accessBindingName('[ACCOUNT]', '[ACCESS_BINDING]');

    get_access_binding_sample($formattedName);
}

getAccount

Lookup for a single Account.

Parameters
Name Description
name string

Required. The name of the account to lookup. Format: accounts/{account} Example: "accounts/100"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Account
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetAccountRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the account to lookup.
 *                              Format: accounts/{account}
 *                              Example: "accounts/100"
 *                              Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function get_account_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetAccountRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Account $response */
        $response = $analyticsAdminServiceClient->getAccount($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    get_account_sample($formattedName);
}

Looks up a single AdSenseLink.

Parameters
Name Description
name string

Required. Unique identifier for the AdSense Link requested. Format: properties/{propertyId}/adSenseLinks/{linkId} Example: properties/1234/adSenseLinks/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AdSenseLink
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetAdSenseLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Unique identifier for the AdSense Link requested.
 *                              Format: properties/{propertyId}/adSenseLinks/{linkId}
 *                              Example: properties/1234/adSenseLinks/5678
 *                              Please see {@see AnalyticsAdminServiceClient::adSenseLinkName()} for help formatting this field.
 */
function get_ad_sense_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetAdSenseLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AdSenseLink $response */
        $response = $analyticsAdminServiceClient->getAdSenseLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::adSenseLinkName('[PROPERTY]', '[ADSENSE_LINK]');

    get_ad_sense_link_sample($formattedName);
}

getAttributionSettings

Lookup for a AttributionSettings singleton.

Parameters
Name Description
name string

Required. The name of the attribution settings to retrieve. Format: properties/{property}/attributionSettings

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AttributionSettings
Example
use Google\Analytics\Admin\V1alpha\AttributionSettings;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetAttributionSettingsRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the attribution settings to retrieve.
 *                              Format: properties/{property}/attributionSettings
 *                              Please see {@see AnalyticsAdminServiceClient::attributionSettingsName()} for help formatting this field.
 */
function get_attribution_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetAttributionSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AttributionSettings $response */
        $response = $analyticsAdminServiceClient->getAttributionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::attributionSettingsName('[PROPERTY]');

    get_attribution_settings_sample($formattedName);
}

getAudience

Lookup for a single Audience.

Audiences created before 2020 may not be supported. Default audiences will not show filter definitions.

Parameters
Name Description
name string

Required. The name of the Audience to get. Example format: properties/1234/audiences/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetAudienceRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the Audience to get.
 *                              Example format: properties/1234/audiences/5678
 *                              Please see {@see AnalyticsAdminServiceClient::audienceName()} for help formatting this field.
 */
function get_audience_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetAudienceRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->getAudience($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::audienceName('[PROPERTY]', '[AUDIENCE]');

    get_audience_sample($formattedName);
}

Lookup for a single BigQuery Link.

Parameters
Name Description
name string

Required. The name of the BigQuery link to lookup. Format: properties/{property_id}/bigQueryLinks/{bigquery_link_id} Example: properties/123/bigQueryLinks/456

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\BigQueryLink
Example
use Google\Analytics\Admin\V1alpha\BigQueryLink;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetBigQueryLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the BigQuery link to lookup.
 *                              Format: properties/{property_id}/bigQueryLinks/{bigquery_link_id}
 *                              Example: properties/123/bigQueryLinks/456
 *                              Please see {@see AnalyticsAdminServiceClient::bigQueryLinkName()} for help formatting this field.
 */
function get_big_query_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetBigQueryLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var BigQueryLink $response */
        $response = $analyticsAdminServiceClient->getBigQueryLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::bigQueryLinkName('[PROPERTY]', '[BIGQUERY_LINK]');

    get_big_query_link_sample($formattedName);
}

getCalculatedMetric

Lookup for a single CalculatedMetric.

Parameters
Name Description
name string

Required. The name of the CalculatedMetric to get. Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id} Example: properties/1234/calculatedMetrics/Metric01

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CalculatedMetric
Example
use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetCalculatedMetricRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CalculatedMetric to get.
 *                              Format: properties/{property_id}/calculatedMetrics/{calculated_metric_id}
 *                              Example: properties/1234/calculatedMetrics/Metric01
 *                              Please see {@see AnalyticsAdminServiceClient::calculatedMetricName()} for help formatting this field.
 */
function get_calculated_metric_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetCalculatedMetricRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var CalculatedMetric $response */
        $response = $analyticsAdminServiceClient->getCalculatedMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::calculatedMetricName(
        '[PROPERTY]',
        '[CALCULATED_METRIC]'
    );

    get_calculated_metric_sample($formattedName);
}

getChannelGroup

Lookup for a single ChannelGroup.

Parameters
Name Description
name string

Required. The ChannelGroup to get. Example format: properties/1234/channelGroups/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetChannelGroupRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The ChannelGroup to get.
 *                              Example format: properties/1234/channelGroups/5678
 *                              Please see {@see AnalyticsAdminServiceClient::channelGroupName()} for help formatting this field.
 */
function get_channel_group_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetChannelGroupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->getChannelGroup($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::channelGroupName('[PROPERTY]', '[CHANNEL_GROUP]');

    get_channel_group_sample($formattedName);
}

getConversionEvent

Retrieve a single conversion event.

Parameters
Name Description
name string

Required. The resource name of the conversion event to retrieve. Format: properties/{property}/conversionEvents/{conversion_event} Example: "properties/123/conversionEvents/456"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ConversionEvent
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
use Google\Analytics\Admin\V1alpha\GetConversionEventRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the conversion event to retrieve.
 *                              Format: properties/{property}/conversionEvents/{conversion_event}
 *                              Example: "properties/123/conversionEvents/456"
 *                              Please see {@see AnalyticsAdminServiceClient::conversionEventName()} for help formatting this field.
 */
function get_conversion_event_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetConversionEventRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ConversionEvent $response */
        $response = $analyticsAdminServiceClient->getConversionEvent($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::conversionEventName(
        '[PROPERTY]',
        '[CONVERSION_EVENT]'
    );

    get_conversion_event_sample($formattedName);
}

getCustomDimension

Lookup for a single CustomDimension.

Parameters
Name Description
name string

Required. The name of the CustomDimension to get. Example format: properties/1234/customDimensions/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
use Google\Analytics\Admin\V1alpha\GetCustomDimensionRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CustomDimension to get.
 *                              Example format: properties/1234/customDimensions/5678
 *                              Please see {@see AnalyticsAdminServiceClient::customDimensionName()} for help formatting this field.
 */
function get_custom_dimension_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetCustomDimensionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->getCustomDimension($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::customDimensionName(
        '[PROPERTY]',
        '[CUSTOM_DIMENSION]'
    );

    get_custom_dimension_sample($formattedName);
}

getCustomMetric

Lookup for a single CustomMetric.

Parameters
Name Description
name string

Required. The name of the CustomMetric to get. Example format: properties/1234/customMetrics/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
use Google\Analytics\Admin\V1alpha\GetCustomMetricRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the CustomMetric to get.
 *                              Example format: properties/1234/customMetrics/5678
 *                              Please see {@see AnalyticsAdminServiceClient::customMetricName()} for help formatting this field.
 */
function get_custom_metric_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetCustomMetricRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->getCustomMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');

    get_custom_metric_sample($formattedName);
}

getDataRedactionSettings

Lookup for a single DataRedactionSettings.

Parameters
Name Description
name string

Required. The name of the settings to lookup. Format: properties/{property}/dataStreams/{data_stream}/dataRedactionSettings Example: "properties/1000/dataStreams/2000/dataRedactionSettings"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataRedactionSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRedactionSettings;
use Google\Analytics\Admin\V1alpha\GetDataRedactionSettingsRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the settings to lookup.
 *                              Format:
 *                              properties/{property}/dataStreams/{data_stream}/dataRedactionSettings
 *                              Example: "properties/1000/dataStreams/2000/dataRedactionSettings"
 *                              Please see {@see AnalyticsAdminServiceClient::dataRedactionSettingsName()} for help formatting this field.
 */
function get_data_redaction_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDataRedactionSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DataRedactionSettings $response */
        $response = $analyticsAdminServiceClient->getDataRedactionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::dataRedactionSettingsName(
        '[PROPERTY]',
        '[DATA_STREAM]'
    );

    get_data_redaction_settings_sample($formattedName);
}

getDataRetentionSettings

Returns the singleton data retention settings for this property.

Parameters
Name Description
name string

Required. The name of the settings to lookup. Format: properties/{property}/dataRetentionSettings Example: "properties/1000/dataRetentionSettings"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataRetentionSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRetentionSettings;
use Google\Analytics\Admin\V1alpha\GetDataRetentionSettingsRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the settings to lookup.
 *                              Format:
 *                              properties/{property}/dataRetentionSettings
 *                              Example: "properties/1000/dataRetentionSettings"
 *                              Please see {@see AnalyticsAdminServiceClient::dataRetentionSettingsName()} for help formatting this field.
 */
function get_data_retention_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDataRetentionSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DataRetentionSettings $response */
        $response = $analyticsAdminServiceClient->getDataRetentionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::dataRetentionSettingsName('[PROPERTY]');

    get_data_retention_settings_sample($formattedName);
}

getDataSharingSettings

Get data sharing settings on an account.

Data sharing settings are singletons.

Parameters
Name Description
name string

Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataSharingSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataSharingSettings;
use Google\Analytics\Admin\V1alpha\GetDataSharingSettingsRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the settings to lookup.
 *                              Format: accounts/{account}/dataSharingSettings
 *                              Example: "accounts/1000/dataSharingSettings"
 *                              Please see {@see AnalyticsAdminServiceClient::dataSharingSettingsName()} for help formatting this field.
 */
function get_data_sharing_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDataSharingSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DataSharingSettings $response */
        $response = $analyticsAdminServiceClient->getDataSharingSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::dataSharingSettingsName('[ACCOUNT]');

    get_data_sharing_settings_sample($formattedName);
}

getDataStream

Lookup for a single DataStream.

Parameters
Name Description
name string

Required. The name of the DataStream to get. Example format: properties/1234/dataStreams/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
use Google\Analytics\Admin\V1alpha\GetDataStreamRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DataStream to get.
 *                              Example format: properties/1234/dataStreams/5678
 *                              Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function get_data_stream_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDataStreamRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->getDataStream($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    get_data_stream_sample($formattedName);
}

Look up a single DisplayVideo360AdvertiserLink

Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLink to get. Example format: properties/1234/displayVideo360AdvertiserLink/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
use Google\Analytics\Admin\V1alpha\GetDisplayVideo360AdvertiserLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLink to get.
 *                              Example format: properties/1234/displayVideo360AdvertiserLink/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkName()} for help formatting this field.
 */
function get_display_video360_advertiser_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDisplayVideo360AdvertiserLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->getDisplayVideo360AdvertiserLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK]'
    );

    get_display_video360_advertiser_link_sample($formattedName);
}

getDisplayVideo360AdvertiserLinkProposal

Lookup for a single DisplayVideo360AdvertiserLinkProposal.

Parameters
Name Description
name string

Required. The name of the DisplayVideo360AdvertiserLinkProposal to get. Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
use Google\Analytics\Admin\V1alpha\GetDisplayVideo360AdvertiserLinkProposalRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the DisplayVideo360AdvertiserLinkProposal to get.
 *                              Example format: properties/1234/displayVideo360AdvertiserLinkProposals/5678
 *                              Please see {@see AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName()} for help formatting this field.
 */
function get_display_video360_advertiser_link_proposal_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetDisplayVideo360AdvertiserLinkProposalRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->getDisplayVideo360AdvertiserLinkProposal($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::displayVideo360AdvertiserLinkProposalName(
        '[PROPERTY]',
        '[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]'
    );

    get_display_video360_advertiser_link_proposal_sample($formattedName);
}

getEnhancedMeasurementSettings

Returns the enhanced measurement settings for this data stream.

Note that the stream must enable enhanced measurement for these settings to take effect.

Parameters
Name Description
name string

Required. The name of the settings to lookup. Format: properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings Example: "properties/1000/dataStreams/2000/enhancedMeasurementSettings"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings;
use Google\Analytics\Admin\V1alpha\GetEnhancedMeasurementSettingsRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the settings to lookup.
 *                              Format:
 *                              properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings
 *                              Example: "properties/1000/dataStreams/2000/enhancedMeasurementSettings"
 *                              Please see {@see AnalyticsAdminServiceClient::enhancedMeasurementSettingsName()} for help formatting this field.
 */
function get_enhanced_measurement_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetEnhancedMeasurementSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var EnhancedMeasurementSettings $response */
        $response = $analyticsAdminServiceClient->getEnhancedMeasurementSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::enhancedMeasurementSettingsName(
        '[PROPERTY]',
        '[DATA_STREAM]'
    );

    get_enhanced_measurement_settings_sample($formattedName);
}

getEventCreateRule

Lookup for a single EventCreateRule.

Parameters
Name Description
name string

Required. The name of the EventCreateRule to get. Example format: properties/123/dataStreams/456/eventCreateRules/789

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
use Google\Analytics\Admin\V1alpha\GetEventCreateRuleRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the EventCreateRule to get.
 *                              Example format: properties/123/dataStreams/456/eventCreateRules/789
 *                              Please see {@see AnalyticsAdminServiceClient::eventCreateRuleName()} for help formatting this field.
 */
function get_event_create_rule_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetEventCreateRuleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->getEventCreateRule($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::eventCreateRuleName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[EVENT_CREATE_RULE]'
    );

    get_event_create_rule_sample($formattedName);
}

getExpandedDataSet

Lookup for a single ExpandedDataSet.

Parameters
Name Description
name string

Required. The name of the ExpandedDataSet to get. Example format: properties/1234/expandedDataSets/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
use Google\Analytics\Admin\V1alpha\GetExpandedDataSetRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the ExpandedDataSet to get.
 *                              Example format: properties/1234/expandedDataSets/5678
 *                              Please see {@see AnalyticsAdminServiceClient::expandedDataSetName()} for help formatting this field.
 */
function get_expanded_data_set_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetExpandedDataSetRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->getExpandedDataSet($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::expandedDataSetName(
        '[PROPERTY]',
        '[EXPANDED_DATA_SET]'
    );

    get_expanded_data_set_sample($formattedName);
}

getGlobalSiteTag

Returns the Site Tag for the specified web stream.

Site Tags are immutable singletons.

Parameters
Name Description
name string

Required. The name of the site tag to lookup. Note that site tags are singletons and do not have unique IDs. Format: properties/{property_id}/dataStreams/{stream_id}/globalSiteTag Example: "properties/123/dataStreams/456/globalSiteTag"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\GlobalSiteTag
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetGlobalSiteTagRequest;
use Google\Analytics\Admin\V1alpha\GlobalSiteTag;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the site tag to lookup.
 *                              Note that site tags are singletons and do not have unique IDs.
 *                              Format: properties/{property_id}/dataStreams/{stream_id}/globalSiteTag
 *                              Example: "properties/123/dataStreams/456/globalSiteTag"
 *                              Please see {@see AnalyticsAdminServiceClient::globalSiteTagName()} for help formatting this field.
 */
function get_global_site_tag_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetGlobalSiteTagRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var GlobalSiteTag $response */
        $response = $analyticsAdminServiceClient->getGlobalSiteTag($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::globalSiteTagName('[PROPERTY]', '[DATA_STREAM]');

    get_global_site_tag_sample($formattedName);
}

getGoogleSignalsSettings

Lookup for Google Signals settings for a property.

Parameters
Name Description
name string

Required. The name of the google signals settings to retrieve. Format: properties/{property}/googleSignalsSettings

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\GoogleSignalsSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetGoogleSignalsSettingsRequest;
use Google\Analytics\Admin\V1alpha\GoogleSignalsSettings;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the google signals settings to retrieve.
 *                              Format: properties/{property}/googleSignalsSettings
 *                              Please see {@see AnalyticsAdminServiceClient::googleSignalsSettingsName()} for help formatting this field.
 */
function get_google_signals_settings_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetGoogleSignalsSettingsRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var GoogleSignalsSettings $response */
        $response = $analyticsAdminServiceClient->getGoogleSignalsSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::googleSignalsSettingsName('[PROPERTY]');

    get_google_signals_settings_sample($formattedName);
}

getMeasurementProtocolSecret

Lookup for a single "GA4" MeasurementProtocolSecret.

Parameters
Name Description
name string

Required. The name of the measurement protocol secret to lookup. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetMeasurementProtocolSecretRequest;
use Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the measurement protocol secret to lookup.
 *                              Format:
 *                              properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
 *                              Please see {@see AnalyticsAdminServiceClient::measurementProtocolSecretName()} for help formatting this field.
 */
function get_measurement_protocol_secret_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetMeasurementProtocolSecretRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->getMeasurementProtocolSecret($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::measurementProtocolSecretName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[MEASUREMENT_PROTOCOL_SECRET]'
    );

    get_measurement_protocol_secret_sample($formattedName);
}

getProperty

Lookup for a single "GA4" Property.

Parameters
Name Description
name string

Required. The name of the property to lookup. Format: properties/{property_id} Example: "properties/1000"

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetPropertyRequest;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the property to lookup.
 *                              Format: properties/{property_id}
 *                              Example: "properties/1000"
 *                              Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function get_property_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetPropertyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->getProperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    get_property_sample($formattedName);
}

Lookup for a single roll-up property source Link.

Only roll-up properties can have source links, so this method will throw an error if used on other types of properties.

Parameters
Name Description
name string

Required. The name of the roll-up property source link to lookup. Format: properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} Example: properties/123/rollupPropertySourceLinks/456

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\RollupPropertySourceLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetRollupPropertySourceLinkRequest;
use Google\Analytics\Admin\V1alpha\RollupPropertySourceLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the roll-up property source link to lookup.
 *                              Format:
 *                              properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id}
 *                              Example: properties/123/rollupPropertySourceLinks/456
 *                              Please see {@see AnalyticsAdminServiceClient::rollupPropertySourceLinkName()} for help formatting this field.
 */
function get_rollup_property_source_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetRollupPropertySourceLinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var RollupPropertySourceLink $response */
        $response = $analyticsAdminServiceClient->getRollupPropertySourceLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::rollupPropertySourceLinkName(
        '[PROPERTY]',
        '[ROLLUP_PROPERTY_SOURCE_LINK]'
    );

    get_rollup_property_source_link_sample($formattedName);
}

getSKAdNetworkConversionValueSchema

Looks up a single SKAdNetworkConversionValueSchema.

Parameters
Name Description
name string

Required. The resource name of SKAdNetwork conversion value schema to look up. Format: properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetSKAdNetworkConversionValueSchemaRequest;
use Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of SKAdNetwork conversion value schema to look
 *                              up. Format:
 *                              properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}
 *                              Please see {@see AnalyticsAdminServiceClient::sKAdNetworkConversionValueSchemaName()} for help formatting this field.
 */
function get_sk_ad_network_conversion_value_schema_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetSKAdNetworkConversionValueSchemaRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var SKAdNetworkConversionValueSchema $response */
        $response = $analyticsAdminServiceClient->getSKAdNetworkConversionValueSchema($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::sKAdNetworkConversionValueSchemaName(
        '[PROPERTY]',
        '[DATA_STREAM]',
        '[SKADNETWORK_CONVERSION_VALUE_SCHEMA]'
    );

    get_sk_ad_network_conversion_value_schema_sample($formattedName);
}

Look up a single SearchAds360Link

Parameters
Name Description
name string

Required. The name of the SearchAds360Link to get. Example format: properties/1234/SearchAds360Link/5678

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetSearchAds360LinkRequest;
use Google\Analytics\Admin\V1alpha\SearchAds360Link;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The name of the SearchAds360Link to get.
 *                              Example format: properties/1234/SearchAds360Link/5678
 *                              Please see {@see AnalyticsAdminServiceClient::searchAds360LinkName()} for help formatting this field.
 */
function get_search_ads360_link_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetSearchAds360LinkRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var SearchAds360Link $response */
        $response = $analyticsAdminServiceClient->getSearchAds360Link($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::searchAds360LinkName(
        '[PROPERTY]',
        '[SEARCH_ADS_360_LINK]'
    );

    get_search_ads360_link_sample($formattedName);
}

getSubpropertyEventFilter

Lookup for a single subproperty Event Filter.

Parameters
Name Description
name string

Required. Resource name of the subproperty event filter to lookup. Format: properties/property_id/subpropertyEventFilters/subproperty_event_filter Example: properties/123/subpropertyEventFilters/456

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SubpropertyEventFilter
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GetSubpropertyEventFilterRequest;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilter;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName Resource name of the subproperty event filter to lookup.
 *                              Format:
 *                              properties/property_id/subpropertyEventFilters/subproperty_event_filter
 *                              Example: properties/123/subpropertyEventFilters/456
 *                              Please see {@see AnalyticsAdminServiceClient::subpropertyEventFilterName()} for help formatting this field.
 */
function get_subproperty_event_filter_sample(string $formattedName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new GetSubpropertyEventFilterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var SubpropertyEventFilter $response */
        $response = $analyticsAdminServiceClient->getSubpropertyEventFilter($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AnalyticsAdminServiceClient::subpropertyEventFilterName(
        '[PROPERTY]',
        '[SUB_PROPERTY_EVENT_FILTER]'
    );

    get_subproperty_event_filter_sample($formattedName);
}

listAccessBindings

Lists all access bindings on an account or property.

Parameters
Name Description
parent string

Required. Formats:

  • accounts/{account}
  • properties/{property}
optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListAccessBindingsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Formats:
 *                                - accounts/{account}
 *                                - properties/{property}
 *                                Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function list_access_bindings_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListAccessBindingsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listAccessBindings($request);

        /** @var AccessBinding $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    list_access_bindings_sample($formattedParent);
}

listAccountSummaries

Returns summaries of all accounts accessible by the caller.

Parameters
Name Description
optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AccountSummary;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListAccountSummariesRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_account_summaries_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new ListAccountSummariesRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listAccountSummaries($request);

        /** @var AccountSummary $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listAccounts

Returns all accounts accessible by the caller.

Note that these accounts might not currently have GA4 properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.

Parameters
Name Description
optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ showDeleted bool

Whether to include soft-deleted (ie: "trashed") Accounts in the results. Accounts can be inspected to determine whether they are deleted or not.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListAccountsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_accounts_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new ListAccountsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listAccounts($request);

        /** @var Account $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

Lists AdSenseLinks on a property.

Parameters
Name Description
parent string

Required. Resource name of the parent property. Format: properties/{propertyId} Example: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListAdSenseLinksRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Resource name of the parent property.
 *                                Format: properties/{propertyId}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_ad_sense_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListAdSenseLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listAdSenseLinks($request);

        /** @var AdSenseLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_ad_sense_links_sample($formattedParent);
}

listAudiences

Lists Audiences on a property.

Audiences created before 2020 may not be supported. Default audiences will not show filter definitions.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListAudiencesRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_audiences_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListAudiencesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listAudiences($request);

        /** @var Audience $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_audiences_sample($formattedParent);
}

Lists BigQuery Links on a property.

Parameters
Name Description
parent string

Required. The name of the property to list BigQuery links under. Format: properties/{property_id} Example: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\BigQueryLink;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListBigQueryLinksRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The name of the property to list BigQuery links under.
 *                                Format: properties/{property_id}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_big_query_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListBigQueryLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listBigQueryLinks($request);

        /** @var BigQueryLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_big_query_links_sample($formattedParent);
}

listCalculatedMetrics

Lists CalculatedMetrics on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListCalculatedMetricsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_calculated_metrics_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListCalculatedMetricsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listCalculatedMetrics($request);

        /** @var CalculatedMetric $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_calculated_metrics_sample($formattedParent);
}

listChannelGroups

Lists ChannelGroups on a property.

Parameters
Name Description
parent string

Required. The property for which to list ChannelGroups. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListChannelGroupsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The property for which to list ChannelGroups.
 *                                Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_channel_groups_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListChannelGroupsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listChannelGroups($request);

        /** @var ChannelGroup $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_channel_groups_sample($formattedParent);
}

listConnectedSiteTags

Lists the connected site tags for a Universal Analytics property. A maximum of 20 connected site tags will be returned. Note: this has no effect on GA4 property.

Parameters
Name Description
optionalArgs array

Optional.

↳ property string

The Universal Analytics property to fetch connected site tags for. This does not work on GA4 properties. A maximum of 20 connected site tags will be returned. Example Format: properties/1234

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsRequest;
use Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsResponse;
use Google\ApiCore\ApiException;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_connected_site_tags_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new ListConnectedSiteTagsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var ListConnectedSiteTagsResponse $response */
        $response = $analyticsAdminServiceClient->listConnectedSiteTags($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listConversionEvents

Returns a list of conversion events in the specified parent property.

Returns an empty list if no conversion events are found.

Parameters
Name Description
parent string

Required. The resource name of the parent property. Example: 'properties/123'

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
use Google\Analytics\Admin\V1alpha\ListConversionEventsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The resource name of the parent property.
 *                                Example: 'properties/123'
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_conversion_events_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListConversionEventsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listConversionEvents($request);

        /** @var ConversionEvent $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_conversion_events_sample($formattedParent);
}

listCustomDimensions

Lists CustomDimensions on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
use Google\Analytics\Admin\V1alpha\ListCustomDimensionsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_custom_dimensions_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListCustomDimensionsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listCustomDimensions($request);

        /** @var CustomDimension $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_custom_dimensions_sample($formattedParent);
}

listCustomMetrics

Lists CustomMetrics on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
use Google\Analytics\Admin\V1alpha\ListCustomMetricsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_custom_metrics_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListCustomMetricsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listCustomMetrics($request);

        /** @var CustomMetric $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_custom_metrics_sample($formattedParent);
}

listDataStreams

Lists DataStreams on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
use Google\Analytics\Admin\V1alpha\ListDataStreamsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_data_streams_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListDataStreamsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listDataStreams($request);

        /** @var DataStream $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_data_streams_sample($formattedParent);
}

listDisplayVideo360AdvertiserLinkProposals

Lists DisplayVideo360AdvertiserLinkProposals on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
use Google\Analytics\Admin\V1alpha\ListDisplayVideo360AdvertiserLinkProposalsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_display_video360_advertiser_link_proposals_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListDisplayVideo360AdvertiserLinkProposalsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listDisplayVideo360AdvertiserLinkProposals($request);

        /** @var DisplayVideo360AdvertiserLinkProposal $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_display_video360_advertiser_link_proposals_sample($formattedParent);
}

Lists all DisplayVideo360AdvertiserLinks on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
use Google\Analytics\Admin\V1alpha\ListDisplayVideo360AdvertiserLinksRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_display_video360_advertiser_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListDisplayVideo360AdvertiserLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listDisplayVideo360AdvertiserLinks($request);

        /** @var DisplayVideo360AdvertiserLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_display_video360_advertiser_links_sample($formattedParent);
}

listEventCreateRules

Lists EventCreateRules on a web data stream.

Parameters
Name Description
parent string

Required. Example format: properties/123/dataStreams/456

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
use Google\Analytics\Admin\V1alpha\ListEventCreateRulesRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/123/dataStreams/456
 *                                Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function list_event_create_rules_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListEventCreateRulesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listEventCreateRules($request);

        /** @var EventCreateRule $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    list_event_create_rules_sample($formattedParent);
}

listExpandedDataSets

Lists ExpandedDataSets on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
use Google\Analytics\Admin\V1alpha\ListExpandedDataSetsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_expanded_data_sets_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListExpandedDataSetsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listExpandedDataSets($request);

        /** @var ExpandedDataSet $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_expanded_data_sets_sample($formattedParent);
}

Lists FirebaseLinks on a property.

Properties can have at most one FirebaseLink.

Parameters
Name Description
parent string

Required. Format: properties/{property_id} Example: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\FirebaseLink;
use Google\Analytics\Admin\V1alpha\ListFirebaseLinksRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Format: properties/{property_id}
 *                                Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_firebase_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListFirebaseLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listFirebaseLinks($request);

        /** @var FirebaseLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_firebase_links_sample($formattedParent);
}

Lists GoogleAdsLinks on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleAdsLink;
use Google\Analytics\Admin\V1alpha\ListGoogleAdsLinksRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_google_ads_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListGoogleAdsLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listGoogleAdsLinks($request);

        /** @var GoogleAdsLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_google_ads_links_sample($formattedParent);
}

listMeasurementProtocolSecrets

Returns child MeasurementProtocolSecrets under the specified parent Property.

Parameters
Name Description
parent string

Required. The resource name of the parent stream. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListMeasurementProtocolSecretsRequest;
use Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The resource name of the parent stream.
 *                                Format:
 *                                properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets
 *                                Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function list_measurement_protocol_secrets_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListMeasurementProtocolSecretsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listMeasurementProtocolSecrets($request);

        /** @var MeasurementProtocolSecret $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    list_measurement_protocol_secrets_sample($formattedParent);
}

listProperties

Returns child Properties under the specified parent Account.

Only "GA4" properties will be returned. Properties will be excluded if the caller does not have access. Soft-deleted (ie: "trashed") properties are excluded by default. Returns an empty list if no relevant properties are found.

Parameters
Name Description
filter string

Required. An expression for filtering the results of the request. Fields eligible for filtering are: parent:(The resource name of the parent account/property) or ancestor:(The resource name of the parent account) or firebase_project:(The id or number of the linked firebase project). Some examples of filters:

| Filter                      | Description                               |
|-----------------------------|-------------------------------------------|
| parent:accounts/123         | The account with account id: 123.       |
| parent:properties/123       | The property with property id: 123.       |
| ancestor:accounts/123       | The account with account id: 123.         |
| firebase_project:project-id | The firebase project with id: project-id. |
| firebase_project:123        | The firebase project with number: 123.    |
optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ showDeleted bool

Whether to include soft-deleted (ie: "trashed") Properties in the results. Properties can be inspected to determine whether they are deleted or not.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListPropertiesRequest;
use Google\Analytics\Admin\V1alpha\Property;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $filter An expression for filtering the results of the request.
 *                       Fields eligible for filtering are:
 *                       `parent:`(The resource name of the parent account/property) or
 *                       `ancestor:`(The resource name of the parent account) or
 *                       `firebase_project:`(The id or number of the linked firebase project).
 *                       Some examples of filters:
 *
 *                       ```
 *                       | Filter                      | Description                               |
 *                       |-----------------------------|-------------------------------------------|
 *                       | parent:accounts/123         | The account with account id: 123.       |
 *                       | parent:properties/123       | The property with property id: 123.       |
 *                       | ancestor:accounts/123       | The account with account id: 123.         |
 *                       | firebase_project:project-id | The firebase project with id: project-id. |
 *                       | firebase_project:123        | The firebase project with number: 123.    |
 *                       ```
 */
function list_properties_sample(string $filter): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListPropertiesRequest())
        ->setFilter($filter);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listProperties($request);

        /** @var Property $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $filter = '[FILTER]';

    list_properties_sample($filter);
}

Lists roll-up property source Links on a property.

Only roll-up properties can have source links, so this method will throw an error if used on other types of properties.

Parameters
Name Description
parent string

Required. The name of the roll-up property to list roll-up property source links under. Format: properties/{property_id} Example: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListRollupPropertySourceLinksRequest;
use Google\Analytics\Admin\V1alpha\RollupPropertySourceLink;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The name of the roll-up property to list roll-up property source
 *                                links under. Format: properties/{property_id} Example: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_rollup_property_source_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListRollupPropertySourceLinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listRollupPropertySourceLinks($request);

        /** @var RollupPropertySourceLink $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_rollup_property_source_links_sample($formattedParent);
}

listSKAdNetworkConversionValueSchemas

Lists SKAdNetworkConversionValueSchema on a stream.

Properties can have at most one SKAdNetworkConversionValueSchema.

Parameters
Name Description
parent string

Required. The DataStream resource to list schemas for. Format: properties/{property_id}/dataStreams/{dataStream} Example: properties/1234/dataStreams/5678

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListSKAdNetworkConversionValueSchemasRequest;
use Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The DataStream resource to list schemas for.
 *                                Format:
 *                                properties/{property_id}/dataStreams/{dataStream}
 *                                Example: properties/1234/dataStreams/5678
 *                                Please see {@see AnalyticsAdminServiceClient::dataStreamName()} for help formatting this field.
 */
function list_sk_ad_network_conversion_value_schemas_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListSKAdNetworkConversionValueSchemasRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listSKAdNetworkConversionValueSchemas($request);

        /** @var SKAdNetworkConversionValueSchema $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::dataStreamName('[PROPERTY]', '[DATA_STREAM]');

    list_sk_ad_network_conversion_value_schemas_sample($formattedParent);
}

Lists all SearchAds360Links on a property.

Parameters
Name Description
parent string

Required. Example format: properties/1234

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListSearchAds360LinksRequest;
use Google\Analytics\Admin\V1alpha\SearchAds360Link;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Example format: properties/1234
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_search_ads360_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListSearchAds360LinksRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listSearchAds360Links($request);

        /** @var SearchAds360Link $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_search_ads360_links_sample($formattedParent);
}

listSubpropertyEventFilters

List all subproperty Event Filters on a property.

Parameters
Name Description
parent string

Required. Resource name of the ordinary property. Format: properties/property_id Example: properties/123

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ListSubpropertyEventFiltersRequest;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilter;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent Resource name of the ordinary property.
 *                                Format: properties/property_id
 *                                Example: properties/123
 *                                Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
 */
function list_subproperty_event_filters_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new ListSubpropertyEventFiltersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->listSubpropertyEventFilters($request);

        /** @var SubpropertyEventFilter $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');

    list_subproperty_event_filters_sample($formattedParent);
}

provisionAccountTicket

Requests a ticket for creating an account.

Parameters
Name Description
optionalArgs array

Optional.

↳ account Account

The account to create.

↳ redirectUri string

Redirect URI where the user will be sent after accepting Terms of Service. Must be configured in Cloud Console as a Redirect URI.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ProvisionAccountTicketResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ProvisionAccountTicketRequest;
use Google\Analytics\Admin\V1alpha\ProvisionAccountTicketResponse;
use Google\ApiCore\ApiException;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function provision_account_ticket_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new ProvisionAccountTicketRequest();

    // Call the API and handle any network failures.
    try {
        /** @var ProvisionAccountTicketResponse $response */
        $response = $analyticsAdminServiceClient->provisionAccountTicket($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

runAccessReport

Returns a customized report of data access records. The report provides records of each time a user reads Google Analytics reporting data. Access records are retained for up to 2 years.

Data Access Reports can be requested for a property. Reports may be requested for any property, but dimensions that aren't related to quota can only be requested on Google Analytics 360 properties. This method is only available to Administrators.

These data access records include GA4 UI Reporting, GA4 UI Explorations, GA4 Data API, and other products like Firebase & Admob that can retrieve data from Google Analytics through a linkage. These records don't include property configuration changes like adding a stream or changing a property's time zone. For configuration change history, see searchChangeHistoryEvents.

Parameters
Name Description
optionalArgs array

Optional.

↳ entity string

The Data Access Report supports requesting at the property level or account level. If requested at the account level, Data Access Reports include all access for all properties under that account. To request at the property level, entity should be for example 'properties/123' if "123" is your GA4 property ID. To request at the account level, entity should be for example 'accounts/1234' if "1234" is your GA4 Account ID.

↳ dimensions AccessDimension[]

The dimensions requested and displayed in the response. Requests are allowed up to 9 dimensions.

↳ metrics AccessMetric[]

The metrics requested and displayed in the response. Requests are allowed up to 10 metrics.

↳ dateRanges AccessDateRange[]

Date ranges of access records to read. If multiple date ranges are requested, each response row will contain a zero based date range index. If two date ranges overlap, the access records for the overlapping days is included in the response rows for both date ranges. Requests are allowed up to 2 date ranges.

↳ dimensionFilter AccessFilterExpression

Dimension filters let you restrict report response to specific dimension values which match the filter. For example, filtering on access records of a single user. To learn more, see Fundamentals of Dimension Filters for examples. Metrics cannot be used in this filter.

↳ metricFilter AccessFilterExpression

Metric filters allow you to restrict report response to specific metric values which match the filter. Metric filters are applied after aggregating the report's rows, similar to SQL having-clause. Dimensions cannot be used in this filter.

↳ offset int

The row count of the start row. The first row is counted as row 0. If offset is unspecified, it is treated as 0. If offset is zero, then this method will return the first page of results with limit entries. To learn more about this pagination parameter, see Pagination.

↳ limit int

The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 100,000 rows per request, no matter how many you ask for. limit must be positive. The API may return fewer rows than the requested limit, if there aren't as many remaining rows as the limit. For instance, there are fewer than 300 possible values for the dimension country, so when reporting on only country, you can't get more than 300 rows, even if you set limit to a higher value. To learn more about this pagination parameter, see Pagination.

↳ timeZone string

This request's time zone if specified. If unspecified, the property's time zone is used. The request's time zone is used to interpret the start & end dates of the report. Formatted as strings from the IANA Time Zone database (https://www.iana.org/time-zones); for example "America/New_York" or "Asia/Tokyo".

↳ orderBys AccessOrderBy[]

Specifies how rows are ordered in the response.

↳ returnEntityQuota bool

Toggles whether to return the current state of this Analytics Property's quota. Quota is returned in AccessQuota. For account-level requests, this field must be false.

↳ includeAllUsers bool

Optional. Determines whether to include users who have never made an API call in the response. If true, all users with access to the specified property or account are included in the response, regardless of whether they have made an API call or not. If false, only the users who have made an API call will be included.

↳ expandGroups bool

Optional. Decides whether to return the users within user groups. This field works only when include_all_users is set to true. If true, it will return all users with access to the specified property or account. If false, only the users with direct access will be returned.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\RunAccessReportResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\RunAccessReportRequest;
use Google\Analytics\Admin\V1alpha\RunAccessReportResponse;
use Google\ApiCore\ApiException;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function run_access_report_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = new RunAccessReportRequest();

    // Call the API and handle any network failures.
    try {
        /** @var RunAccessReportResponse $response */
        $response = $analyticsAdminServiceClient->runAccessReport($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

searchChangeHistoryEvents

Searches through all changes to an account or its children given the specified set of filters.

Parameters
Name Description
account string

Required. The account resource for which to return change history resources. Format: accounts/{account} Example: "accounts/100"

optionalArgs array

Optional.

↳ property string

Optional. Resource name for a child property. If set, only return changes made to this property or its child resources. Format: properties/{propertyId} Example: "properties/100"

↳ resourceType int[]

Optional. If set, only return changes if they are for a resource that matches at least one of these types. For allowed values, use constants defined on Google\Analytics\Admin\V1alpha\ChangeHistoryResourceType

↳ action int[]

Optional. If set, only return changes that match one or more of these types of actions. For allowed values, use constants defined on Google\Analytics\Admin\V1alpha\ActionType

↳ actorEmail string[]

Optional. If set, only return changes if they are made by a user in this list.

↳ earliestChangeTime Timestamp

Optional. If set, only return changes made after this time (inclusive).

↳ latestChangeTime Timestamp

Optional. If set, only return changes made before this time (inclusive).

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\ChangeHistoryEvent;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\SearchChangeHistoryEventsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedAccount The account resource for which to return change history
 *                                 resources. Format: accounts/{account} Example: "accounts/100"
 *                                 Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function search_change_history_events_sample(string $formattedAccount): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new SearchChangeHistoryEventsRequest())
        ->setAccount($formattedAccount);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $analyticsAdminServiceClient->searchChangeHistoryEvents($request);

        /** @var ChangeHistoryEvent $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedAccount = AnalyticsAdminServiceClient::accountName('[ACCOUNT]');

    search_change_history_events_sample($formattedAccount);
}

setAutomatedGa4ConfigurationOptOut

Sets the opt out status for the automated GA4 setup process for a UA property.

Note: this has no effect on GA4 property.

Parameters
Name Description
property string

Required. The UA property to set the opt out status. Note this request uses the internal property ID, not the tracking ID of the form UA-XXXXXX-YY. Format: properties/{internalWebPropertyId} Example: properties/1234

optionalArgs array

Optional.

↳ optOut bool

The status to set.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SetAutomatedGa4ConfigurationOptOutResponse
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\SetAutomatedGa4ConfigurationOptOutRequest;
use Google\Analytics\Admin\V1alpha\SetAutomatedGa4ConfigurationOptOutResponse;
use Google\ApiCore\ApiException;

/**
 * @param string $property The UA property to set the opt out status. Note this request uses
 *                         the internal property ID, not the tracking ID of the form UA-XXXXXX-YY.
 *                         Format: properties/{internalWebPropertyId}
 *                         Example: properties/1234
 */
function set_automated_ga4_configuration_opt_out_sample(string $property): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $request = (new SetAutomatedGa4ConfigurationOptOutRequest())
        ->setProperty($property);

    // Call the API and handle any network failures.
    try {
        /** @var SetAutomatedGa4ConfigurationOptOutResponse $response */
        $response = $analyticsAdminServiceClient->setAutomatedGa4ConfigurationOptOut($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $property = '[PROPERTY]';

    set_automated_ga4_configuration_opt_out_sample($property);
}

updateAccessBinding

Updates an access binding on an account or property.

Parameters
Name Description
accessBinding Google\Analytics\Admin\V1alpha\AccessBinding

Required. The access binding to update.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateAccessBindingRequest;
use Google\ApiCore\ApiException;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_access_binding_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $accessBinding = new AccessBinding();
    $request = (new UpdateAccessBindingRequest())
        ->setAccessBinding($accessBinding);

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->updateAccessBinding($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateAccount

Updates an account.

Parameters
Name Description
account Google\Analytics\Admin\V1alpha\Account

Required. The account to update. The account's name field is used to identify the account.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (for example, "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Account
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateAccountRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $accountDisplayName Human-readable display name for this account.
 */
function update_account_sample(string $accountDisplayName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $account = (new Account())
        ->setDisplayName($accountDisplayName);
    $updateMask = new FieldMask();
    $request = (new UpdateAccountRequest())
        ->setAccount($account)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var Account $response */
        $response = $analyticsAdminServiceClient->updateAccount($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $accountDisplayName = '[DISPLAY_NAME]';

    update_account_sample($accountDisplayName);
}

updateAttributionSettings

Updates attribution settings on a property.

Parameters
Name Description
attributionSettings Google\Analytics\Admin\V1alpha\AttributionSettings

Required. The attribution settings to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\AttributionSettings
Example
use Google\Analytics\Admin\V1alpha\AttributionSettings;
use Google\Analytics\Admin\V1alpha\AttributionSettings\AcquisitionConversionEventLookbackWindow;
use Google\Analytics\Admin\V1alpha\AttributionSettings\AdsWebConversionDataExportScope;
use Google\Analytics\Admin\V1alpha\AttributionSettings\OtherConversionEventLookbackWindow;
use Google\Analytics\Admin\V1alpha\AttributionSettings\ReportingAttributionModel;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateAttributionSettingsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param int $attributionSettingsAcquisitionConversionEventLookbackWindow The lookback window configuration for acquisition conversion
 *                                                                         events. The default window size is 30 days.
 * @param int $attributionSettingsOtherConversionEventLookbackWindow       The lookback window for all other, non-acquisition conversion
 *                                                                         events. The default window size is 90 days.
 * @param int $attributionSettingsReportingAttributionModel                The reporting attribution model used to calculate conversion
 *                                                                         credit in this property's reports.
 *
 *                                                                         Changing the attribution model will apply to both historical and future
 *                                                                         data. These changes will be reflected in reports with conversion and
 *                                                                         revenue data. User and session data will be unaffected.
 * @param int $attributionSettingsAdsWebConversionDataExportScope          The Conversion Export Scope for data exported to linked Ads
 *                                                                         Accounts.
 */
function update_attribution_settings_sample(
    int $attributionSettingsAcquisitionConversionEventLookbackWindow,
    int $attributionSettingsOtherConversionEventLookbackWindow,
    int $attributionSettingsReportingAttributionModel,
    int $attributionSettingsAdsWebConversionDataExportScope
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $attributionSettings = (new AttributionSettings())
        ->setAcquisitionConversionEventLookbackWindow(
            $attributionSettingsAcquisitionConversionEventLookbackWindow
        )
        ->setOtherConversionEventLookbackWindow($attributionSettingsOtherConversionEventLookbackWindow)
        ->setReportingAttributionModel($attributionSettingsReportingAttributionModel)
        ->setAdsWebConversionDataExportScope($attributionSettingsAdsWebConversionDataExportScope);
    $updateMask = new FieldMask();
    $request = (new UpdateAttributionSettingsRequest())
        ->setAttributionSettings($attributionSettings)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var AttributionSettings $response */
        $response = $analyticsAdminServiceClient->updateAttributionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $attributionSettingsAcquisitionConversionEventLookbackWindow = AcquisitionConversionEventLookbackWindow::ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_UNSPECIFIED;
    $attributionSettingsOtherConversionEventLookbackWindow = OtherConversionEventLookbackWindow::OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_UNSPECIFIED;
    $attributionSettingsReportingAttributionModel = ReportingAttributionModel::REPORTING_ATTRIBUTION_MODEL_UNSPECIFIED;
    $attributionSettingsAdsWebConversionDataExportScope = AdsWebConversionDataExportScope::ADS_WEB_CONVERSION_DATA_EXPORT_SCOPE_UNSPECIFIED;

    update_attribution_settings_sample(
        $attributionSettingsAcquisitionConversionEventLookbackWindow,
        $attributionSettingsOtherConversionEventLookbackWindow,
        $attributionSettingsReportingAttributionModel,
        $attributionSettingsAdsWebConversionDataExportScope
    );
}

updateAudience

Updates an Audience on a property.

Parameters
Name Description
audience Google\Analytics\Admin\V1alpha\Audience

Required. The audience to update. The audience's name field is used to identify the audience to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause\AudienceClauseType;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateAudienceRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $audienceDisplayName             The display name of the Audience.
 * @param string $audienceDescription             The description of the Audience.
 * @param int    $audienceMembershipDurationDays  Immutable. The duration a user should stay in an Audience. It
 *                                                cannot be set to more than 540 days.
 * @param int    $audienceFilterClausesClauseType Specifies whether this is an include or exclude filter clause.
 */
function update_audience_sample(
    string $audienceDisplayName,
    string $audienceDescription,
    int $audienceMembershipDurationDays,
    int $audienceFilterClausesClauseType
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $audienceFilterClause = (new AudienceFilterClause())
        ->setClauseType($audienceFilterClausesClauseType);
    $audienceFilterClauses = [$audienceFilterClause,];
    $audience = (new Audience())
        ->setDisplayName($audienceDisplayName)
        ->setDescription($audienceDescription)
        ->setMembershipDurationDays($audienceMembershipDurationDays)
        ->setFilterClauses($audienceFilterClauses);
    $updateMask = new FieldMask();
    $request = (new UpdateAudienceRequest())
        ->setAudience($audience)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->updateAudience($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $audienceDisplayName = '[DISPLAY_NAME]';
    $audienceDescription = '[DESCRIPTION]';
    $audienceMembershipDurationDays = 0;
    $audienceFilterClausesClauseType = AudienceClauseType::AUDIENCE_CLAUSE_TYPE_UNSPECIFIED;

    update_audience_sample(
        $audienceDisplayName,
        $audienceDescription,
        $audienceMembershipDurationDays,
        $audienceFilterClausesClauseType
    );
}

updateCalculatedMetric

Updates a CalculatedMetric on a property.

Parameters
Name Description
calculatedMetric Google\Analytics\Admin\V1alpha\CalculatedMetric

Required. The CalculatedMetric to update

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CalculatedMetric
Example
use Google\Analytics\Admin\V1alpha\CalculatedMetric;
use Google\Analytics\Admin\V1alpha\CalculatedMetric\MetricUnit;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UpdateCalculatedMetricRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $calculatedMetricDisplayName Display name for this calculated metric as shown in the
 *                                            Google Analytics UI. Max length 82 characters.
 * @param int    $calculatedMetricMetricUnit  The type for the calculated metric's value.
 * @param string $calculatedMetricFormula     The calculated metric's definition. Maximum number of unique
 *                                            referenced custom metrics is 5. Formulas supports the following operations:
 *                                            + (addition),  - (subtraction), - (negative),  * (multiplication), /
 *                                            (division), () (parenthesis). Any valid real numbers are acceptable that
 *                                            fit in a Long (64bit integer) or a Double (64 bit floating point number).
 *                                            Example formula:
 *                                            "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"
 */
function update_calculated_metric_sample(
    string $calculatedMetricDisplayName,
    int $calculatedMetricMetricUnit,
    string $calculatedMetricFormula
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $calculatedMetric = (new CalculatedMetric())
        ->setDisplayName($calculatedMetricDisplayName)
        ->setMetricUnit($calculatedMetricMetricUnit)
        ->setFormula($calculatedMetricFormula);
    $updateMask = new FieldMask();
    $request = (new UpdateCalculatedMetricRequest())
        ->setCalculatedMetric($calculatedMetric)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var CalculatedMetric $response */
        $response = $analyticsAdminServiceClient->updateCalculatedMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $calculatedMetricDisplayName = '[DISPLAY_NAME]';
    $calculatedMetricMetricUnit = MetricUnit::METRIC_UNIT_UNSPECIFIED;
    $calculatedMetricFormula = '[FORMULA]';

    update_calculated_metric_sample(
        $calculatedMetricDisplayName,
        $calculatedMetricMetricUnit,
        $calculatedMetricFormula
    );
}

updateChannelGroup

Updates a ChannelGroup.

Parameters
Name Description
channelGroup Google\Analytics\Admin\V1alpha\ChannelGroup

Required. The ChannelGroup to update. The resource's name field is used to identify the ChannelGroup to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ChannelGroupFilterExpression;
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GroupingRule;
use Google\Analytics\Admin\V1alpha\UpdateChannelGroupRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $channelGroupDisplayName             The display name of the Channel Group. Max length of 80
 *                                                    characters.
 * @param string $channelGroupGroupingRuleDisplayName Customer defined display name for the channel.
 */
function update_channel_group_sample(
    string $channelGroupDisplayName,
    string $channelGroupGroupingRuleDisplayName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $channelGroupGroupingRuleExpression = new ChannelGroupFilterExpression();
    $groupingRule = (new GroupingRule())
        ->setDisplayName($channelGroupGroupingRuleDisplayName)
        ->setExpression($channelGroupGroupingRuleExpression);
    $channelGroupGroupingRule = [$groupingRule,];
    $channelGroup = (new ChannelGroup())
        ->setDisplayName($channelGroupDisplayName)
        ->setGroupingRule($channelGroupGroupingRule);
    $updateMask = new FieldMask();
    $request = (new UpdateChannelGroupRequest())
        ->setChannelGroup($channelGroup)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->updateChannelGroup($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $channelGroupDisplayName = '[DISPLAY_NAME]';
    $channelGroupGroupingRuleDisplayName = '[DISPLAY_NAME]';

    update_channel_group_sample($channelGroupDisplayName, $channelGroupGroupingRuleDisplayName);
}

updateConversionEvent

Updates a conversion event with the specified attributes.

Parameters
Name Description
conversionEvent Google\Analytics\Admin\V1alpha\ConversionEvent

Required. The conversion event to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ConversionEvent
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
use Google\Analytics\Admin\V1alpha\UpdateConversionEventRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_conversion_event_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $conversionEvent = new ConversionEvent();
    $updateMask = new FieldMask();
    $request = (new UpdateConversionEventRequest())
        ->setConversionEvent($conversionEvent)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var ConversionEvent $response */
        $response = $analyticsAdminServiceClient->updateConversionEvent($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateCustomDimension

Updates a CustomDimension on a property.

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ customDimension CustomDimension

The CustomDimension to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
use Google\Analytics\Admin\V1alpha\UpdateCustomDimensionRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_custom_dimension_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateCustomDimensionRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->updateCustomDimension($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateCustomMetric

Updates a CustomMetric on a property.

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ customMetric CustomMetric

The CustomMetric to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
use Google\Analytics\Admin\V1alpha\UpdateCustomMetricRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_custom_metric_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateCustomMetricRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->updateCustomMetric($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateDataRedactionSettings

Updates a DataRedactionSettings on a property.

Parameters
Name Description
dataRedactionSettings Google\Analytics\Admin\V1alpha\DataRedactionSettings

Required. The settings to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataRedactionSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRedactionSettings;
use Google\Analytics\Admin\V1alpha\UpdateDataRedactionSettingsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_data_redaction_settings_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $dataRedactionSettings = new DataRedactionSettings();
    $updateMask = new FieldMask();
    $request = (new UpdateDataRedactionSettingsRequest())
        ->setDataRedactionSettings($dataRedactionSettings)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var DataRedactionSettings $response */
        $response = $analyticsAdminServiceClient->updateDataRedactionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateDataRetentionSettings

Updates the singleton data retention settings for this property.

Parameters
Name Description
dataRetentionSettings Google\Analytics\Admin\V1alpha\DataRetentionSettings

Required. The settings to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataRetentionSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRetentionSettings;
use Google\Analytics\Admin\V1alpha\UpdateDataRetentionSettingsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_data_retention_settings_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $dataRetentionSettings = new DataRetentionSettings();
    $updateMask = new FieldMask();
    $request = (new UpdateDataRetentionSettingsRequest())
        ->setDataRetentionSettings($dataRetentionSettings)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var DataRetentionSettings $response */
        $response = $analyticsAdminServiceClient->updateDataRetentionSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateDataStream

Updates a DataStream on a property.

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ dataStream DataStream

The DataStream to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
use Google\Analytics\Admin\V1alpha\UpdateDataStreamRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_data_stream_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateDataStreamRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->updateDataStream($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

Updates a DisplayVideo360AdvertiserLink on a property.

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ displayVideo360AdvertiserLink DisplayVideo360AdvertiserLink

The DisplayVideo360AdvertiserLink to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
use Google\Analytics\Admin\V1alpha\UpdateDisplayVideo360AdvertiserLinkRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_display_video360_advertiser_link_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateDisplayVideo360AdvertiserLinkRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->updateDisplayVideo360AdvertiserLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateEnhancedMeasurementSettings

Updates the enhanced measurement settings for this data stream.

Note that the stream must enable enhanced measurement for these settings to take effect.

Parameters
Name Description
enhancedMeasurementSettings Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings

Required. The settings to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings;
use Google\Analytics\Admin\V1alpha\UpdateEnhancedMeasurementSettingsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $enhancedMeasurementSettingsSearchQueryParameter URL query parameters to interpret as site search parameters.
 *                                                                Max length is 1024 characters. Must not be empty.
 */
function update_enhanced_measurement_settings_sample(
    string $enhancedMeasurementSettingsSearchQueryParameter
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $enhancedMeasurementSettings = (new EnhancedMeasurementSettings())
        ->setSearchQueryParameter($enhancedMeasurementSettingsSearchQueryParameter);
    $updateMask = new FieldMask();
    $request = (new UpdateEnhancedMeasurementSettingsRequest())
        ->setEnhancedMeasurementSettings($enhancedMeasurementSettings)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var EnhancedMeasurementSettings $response */
        $response = $analyticsAdminServiceClient->updateEnhancedMeasurementSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $enhancedMeasurementSettingsSearchQueryParameter = '[SEARCH_QUERY_PARAMETER]';

    update_enhanced_measurement_settings_sample($enhancedMeasurementSettingsSearchQueryParameter);
}

updateEventCreateRule

Updates an EventCreateRule.

Parameters
Name Description
eventCreateRule Google\Analytics\Admin\V1alpha\EventCreateRule

Required. The EventCreateRule to update. The resource's name field is used to identify the EventCreateRule to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
use Google\Analytics\Admin\V1alpha\MatchingCondition;
use Google\Analytics\Admin\V1alpha\MatchingCondition\ComparisonType;
use Google\Analytics\Admin\V1alpha\UpdateEventCreateRuleRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $eventCreateRuleDestinationEvent              The name of the new event to be created.
 *
 *                                                             This value must:
 *                                                             * be less than 40 characters
 *                                                             * consist only of letters, digits or _ (underscores)
 *                                                             * start with a letter
 * @param string $eventCreateRuleEventConditionsField          The name of the field that is compared against for the condition.
 *                                                             If 'event_name' is specified this condition will apply to the name of the
 *                                                             event.  Otherwise the condition will apply to a parameter with the
 *                                                             specified name.
 *
 *                                                             This value cannot contain spaces.
 * @param int    $eventCreateRuleEventConditionsComparisonType The type of comparison to be applied to the value.
 * @param string $eventCreateRuleEventConditionsValue          The value being compared against for this condition.  The runtime
 *                                                             implementation may perform type coercion of this value to evaluate this
 *                                                             condition based on the type of the parameter value.
 */
function update_event_create_rule_sample(
    string $eventCreateRuleDestinationEvent,
    string $eventCreateRuleEventConditionsField,
    int $eventCreateRuleEventConditionsComparisonType,
    string $eventCreateRuleEventConditionsValue
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $matchingCondition = (new MatchingCondition())
        ->setField($eventCreateRuleEventConditionsField)
        ->setComparisonType($eventCreateRuleEventConditionsComparisonType)
        ->setValue($eventCreateRuleEventConditionsValue);
    $eventCreateRuleEventConditions = [$matchingCondition,];
    $eventCreateRule = (new EventCreateRule())
        ->setDestinationEvent($eventCreateRuleDestinationEvent)
        ->setEventConditions($eventCreateRuleEventConditions);
    $updateMask = new FieldMask();
    $request = (new UpdateEventCreateRuleRequest())
        ->setEventCreateRule($eventCreateRule)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->updateEventCreateRule($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $eventCreateRuleDestinationEvent = '[DESTINATION_EVENT]';
    $eventCreateRuleEventConditionsField = '[FIELD]';
    $eventCreateRuleEventConditionsComparisonType = ComparisonType::COMPARISON_TYPE_UNSPECIFIED;
    $eventCreateRuleEventConditionsValue = '[VALUE]';

    update_event_create_rule_sample(
        $eventCreateRuleDestinationEvent,
        $eventCreateRuleEventConditionsField,
        $eventCreateRuleEventConditionsComparisonType,
        $eventCreateRuleEventConditionsValue
    );
}

updateExpandedDataSet

Updates a ExpandedDataSet on a property.

Parameters
Name Description
expandedDataSet Google\Analytics\Admin\V1alpha\ExpandedDataSet

Required. The ExpandedDataSet to update. The resource's name field is used to identify the ExpandedDataSet to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
use Google\Analytics\Admin\V1alpha\UpdateExpandedDataSetRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $expandedDataSetDisplayName The display name of the ExpandedDataSet.
 *                                           Max 200 chars.
 */
function update_expanded_data_set_sample(string $expandedDataSetDisplayName): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $expandedDataSet = (new ExpandedDataSet())
        ->setDisplayName($expandedDataSetDisplayName);
    $updateMask = new FieldMask();
    $request = (new UpdateExpandedDataSetRequest())
        ->setExpandedDataSet($expandedDataSet)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->updateExpandedDataSet($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $expandedDataSetDisplayName = '[DISPLAY_NAME]';

    update_expanded_data_set_sample($expandedDataSetDisplayName);
}

Updates a GoogleAdsLink on a property

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ googleAdsLink GoogleAdsLink

The GoogleAdsLink to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\GoogleAdsLink
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleAdsLink;
use Google\Analytics\Admin\V1alpha\UpdateGoogleAdsLinkRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_google_ads_link_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateGoogleAdsLinkRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var GoogleAdsLink $response */
        $response = $analyticsAdminServiceClient->updateGoogleAdsLink($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateGoogleSignalsSettings

Updates Google Signals settings for a property.

Parameters
Name Description
googleSignalsSettings Google\Analytics\Admin\V1alpha\GoogleSignalsSettings

Required. The settings to update. The name field is used to identify the settings to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\GoogleSignalsSettings
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleSignalsSettings;
use Google\Analytics\Admin\V1alpha\UpdateGoogleSignalsSettingsRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_google_signals_settings_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $googleSignalsSettings = new GoogleSignalsSettings();
    $updateMask = new FieldMask();
    $request = (new UpdateGoogleSignalsSettingsRequest())
        ->setGoogleSignalsSettings($googleSignalsSettings)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var GoogleSignalsSettings $response */
        $response = $analyticsAdminServiceClient->updateGoogleSignalsSettings($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateMeasurementProtocolSecret

Updates a measurement protocol secret.

Parameters
Name Description
measurementProtocolSecret Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret

Required. The measurement protocol secret to update.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret;
use Google\Analytics\Admin\V1alpha\UpdateMeasurementProtocolSecretRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $measurementProtocolSecretDisplayName Human-readable display name for this secret.
 */
function update_measurement_protocol_secret_sample(
    string $measurementProtocolSecretDisplayName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $measurementProtocolSecret = (new MeasurementProtocolSecret())
        ->setDisplayName($measurementProtocolSecretDisplayName);
    $updateMask = new FieldMask();
    $request = (new UpdateMeasurementProtocolSecretRequest())
        ->setMeasurementProtocolSecret($measurementProtocolSecret)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->updateMeasurementProtocolSecret($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $measurementProtocolSecretDisplayName = '[DISPLAY_NAME]';

    update_measurement_protocol_secret_sample($measurementProtocolSecretDisplayName);
}

updateProperty

Updates a property.

Parameters
Name Description
property Google\Analytics\Admin\V1alpha\Property

Required. The property to update. The property's name field is used to identify the property to be updated.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Field names must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Property;
use Google\Analytics\Admin\V1alpha\UpdatePropertyRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param string $propertyDisplayName Human-readable display name for this property.
 *
 *                                    The max allowed display name length is 100 UTF-16 code units.
 * @param string $propertyTimeZone    Reporting Time Zone, used as the day boundary for reports,
 *                                    regardless of where the data originates. If the time zone honors DST,
 *                                    Analytics will automatically adjust for the changes.
 *
 *                                    NOTE: Changing the time zone only affects data going forward, and is not
 *                                    applied retroactively.
 *
 *                                    Format: https://www.iana.org/time-zones
 *                                    Example: "America/Los_Angeles"
 */
function update_property_sample(string $propertyDisplayName, string $propertyTimeZone): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $property = (new Property())
        ->setDisplayName($propertyDisplayName)
        ->setTimeZone($propertyTimeZone);
    $updateMask = new FieldMask();
    $request = (new UpdatePropertyRequest())
        ->setProperty($property)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->updateProperty($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $propertyDisplayName = '[DISPLAY_NAME]';
    $propertyTimeZone = '[TIME_ZONE]';

    update_property_sample($propertyDisplayName, $propertyTimeZone);
}

updateSKAdNetworkConversionValueSchema

Updates a SKAdNetworkConversionValueSchema.

Parameters
Name Description
skadnetworkConversionValueSchema Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema

Required. SKAdNetwork conversion value schema to update.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\PostbackWindow;
use Google\Analytics\Admin\V1alpha\SKAdNetworkConversionValueSchema;
use Google\Analytics\Admin\V1alpha\UpdateSKAdNetworkConversionValueSchemaRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_sk_ad_network_conversion_value_schema_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $skadnetworkConversionValueSchemaPostbackWindowOne = new PostbackWindow();
    $skadnetworkConversionValueSchema = (new SKAdNetworkConversionValueSchema())
        ->setPostbackWindowOne($skadnetworkConversionValueSchemaPostbackWindowOne);
    $updateMask = new FieldMask();
    $request = (new UpdateSKAdNetworkConversionValueSchemaRequest())
        ->setSkadnetworkConversionValueSchema($skadnetworkConversionValueSchema)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var SKAdNetworkConversionValueSchema $response */
        $response = $analyticsAdminServiceClient->updateSKAdNetworkConversionValueSchema($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

Updates a SearchAds360Link on a property.

Parameters
Name Description
updateMask Google\Protobuf\FieldMask

Required. The list of fields to be updated. Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ searchAds360Link SearchAds360Link

The SearchAds360Link to update

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\SearchAds360Link;
use Google\Analytics\Admin\V1alpha\UpdateSearchAds360LinkRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_search_ads360_link_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateSearchAds360LinkRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var SearchAds360Link $response */
        $response = $analyticsAdminServiceClient->updateSearchAds360Link($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateSubpropertyEventFilter

Updates a subproperty Event Filter.

Parameters
Name Description
subpropertyEventFilter Google\Analytics\Admin\V1alpha\SubpropertyEventFilter

Required. The subproperty event filter to update.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to update. Field names must be in snake case (for example, "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Analytics\Admin\V1alpha\SubpropertyEventFilter
Example
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilter;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterClause;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterClause\FilterClauseType;
use Google\Analytics\Admin\V1alpha\SubpropertyEventFilterExpression;
use Google\Analytics\Admin\V1alpha\UpdateSubpropertyEventFilterRequest;
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;

/**
 * @param int $subpropertyEventFilterFilterClausesFilterClauseType The type for the filter clause.
 */
function update_subproperty_event_filter_sample(
    int $subpropertyEventFilterFilterClausesFilterClauseType
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare the request message.
    $subpropertyEventFilterFilterClausesFilterExpression = new SubpropertyEventFilterExpression();
    $subpropertyEventFilterClause = (new SubpropertyEventFilterClause())
        ->setFilterClauseType($subpropertyEventFilterFilterClausesFilterClauseType)
        ->setFilterExpression($subpropertyEventFilterFilterClausesFilterExpression);
    $subpropertyEventFilterFilterClauses = [$subpropertyEventFilterClause,];
    $subpropertyEventFilter = (new SubpropertyEventFilter())
        ->setFilterClauses($subpropertyEventFilterFilterClauses);
    $updateMask = new FieldMask();
    $request = (new UpdateSubpropertyEventFilterRequest())
        ->setSubpropertyEventFilter($subpropertyEventFilter)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var SubpropertyEventFilter $response */
        $response = $analyticsAdminServiceClient->updateSubpropertyEventFilter($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $subpropertyEventFilterFilterClausesFilterClauseType = FilterClauseType::FILTER_CLAUSE_TYPE_UNSPECIFIED;

    update_subproperty_event_filter_sample($subpropertyEventFilterFilterClausesFilterClauseType);
}

static::accessBindingName

Formats a string containing the fully-qualified path to represent a access_binding resource.

Parameters
Name Description
account string
accessBinding string
Returns
Type Description
string The formatted access_binding resource.

static::accountName

Formats a string containing the fully-qualified path to represent a account resource.

Parameter
Name Description
account string
Returns
Type Description
string The formatted account resource.

static::accountAccessBindingName

Formats a string containing the fully-qualified path to represent a account_access_binding resource.

Parameters
Name Description
account string
accessBinding string
Returns
Type Description
string The formatted account_access_binding resource.

static::adSenseLinkName

Formats a string containing the fully-qualified path to represent a ad_sense_link resource.

Parameters
Name Description
property string
adsenseLink string
Returns
Type Description
string The formatted ad_sense_link resource.

static::attributionSettingsName

Formats a string containing the fully-qualified path to represent a attribution_settings resource.

Parameter
Name Description
property string
Returns
Type Description
string The formatted attribution_settings resource.

static::audienceName

Formats a string containing the fully-qualified path to represent a audience resource.

Parameters
Name Description
property string
audience string
Returns
Type Description
string The formatted audience resource.

static::bigQueryLinkName

Formats a string containing the fully-qualified path to represent a big_query_link resource.

Parameters
Name Description
property string
bigqueryLink string
Returns
Type Description
string The formatted big_query_link resource.

static::calculatedMetricName

Formats a string containing the fully-qualified path to represent a calculated_metric resource.

Parameters
Name Description
property string
calculatedMetric string
Returns
Type Description
string The formatted calculated_metric resource.

static::channelGroupName

Formats a string containing the fully-qualified path to represent a channel_group resource.

Parameters
Name Description
property string
channelGroup string
Returns
Type Description
string The formatted channel_group resource.

static::conversionEventName

Formats a string containing the fully-qualified path to represent a conversion_event resource.

Parameters
Name Description
property string
conversionEvent string
Returns
Type Description
string The formatted conversion_event resource.

static::customDimensionName

Formats a string containing the fully-qualified path to represent a custom_dimension resource.

Parameters
Name Description
property string
customDimension string
Returns
Type Description
string The formatted custom_dimension resource.

static::customMetricName

Formats a string containing the fully-qualified path to represent a custom_metric resource.

Parameters
Name Description
property string
customMetric string
Returns
Type Description
string The formatted custom_metric resource.

static::dataRedactionSettingsName

Formats a string containing the fully-qualified path to represent a data_redaction_settings resource.

Parameters
Name Description
property string
dataStream string
Returns
Type Description
string The formatted data_redaction_settings resource.

static::dataRetentionSettingsName

Formats a string containing the fully-qualified path to represent a data_retention_settings resource.

Parameter
Name Description
property string
Returns
Type Description
string The formatted data_retention_settings resource.

static::dataSharingSettingsName

Formats a string containing the fully-qualified path to represent a data_sharing_settings resource.

Parameter
Name Description
account string
Returns
Type Description
string The formatted data_sharing_settings resource.

static::dataStreamName

Formats a string containing the fully-qualified path to represent a data_stream resource.

Parameters
Name Description
property string
dataStream string
Returns
Type Description
string The formatted data_stream resource.

static::displayVideo360AdvertiserLinkName

Formats a string containing the fully-qualified path to represent a display_video360_advertiser_link resource.

Parameters
Name Description
property string
displayVideo360AdvertiserLink string
Returns
Type Description
string The formatted display_video360_advertiser_link resource.

static::displayVideo360AdvertiserLinkProposalName

Formats a string containing the fully-qualified path to represent a display_video360_advertiser_link_proposal resource.

Parameters
Name Description
property string
displayVideo360AdvertiserLinkProposal string
Returns
Type Description
string The formatted display_video360_advertiser_link_proposal resource.

static::enhancedMeasurementSettingsName

Formats a string containing the fully-qualified path to represent a enhanced_measurement_settings resource.

Parameters
Name Description
property string
dataStream string
Returns
Type Description
string The formatted enhanced_measurement_settings resource.

static::eventCreateRuleName

Formats a string containing the fully-qualified path to represent a event_create_rule resource.

Parameters
Name Description
property string
dataStream string
eventCreateRule string
Returns
Type Description
string The formatted event_create_rule resource.

static::expandedDataSetName

Formats a string containing the fully-qualified path to represent a expanded_data_set resource.

Parameters
Name Description
property string
expandedDataSet string
Returns
Type Description
string The formatted expanded_data_set resource.

static::firebaseLinkName

Formats a string containing the fully-qualified path to represent a firebase_link resource.

Parameters
Name Description
property string
firebaseLink string
Returns
Type Description
string The formatted firebase_link resource.

static::globalSiteTagName

Formats a string containing the fully-qualified path to represent a global_site_tag resource.

Parameters
Name Description
property string
dataStream string
Returns
Type Description
string The formatted global_site_tag resource.

static::googleAdsLinkName

Formats a string containing the fully-qualified path to represent a google_ads_link resource.

Parameters
Name Description
property string
googleAdsLink string
Returns
Type Description
string The formatted google_ads_link resource.

static::googleSignalsSettingsName

Formats a string containing the fully-qualified path to represent a google_signals_settings resource.

Parameter
Name Description
property string
Returns
Type Description
string The formatted google_signals_settings resource.

static::measurementProtocolSecretName

Formats a string containing the fully-qualified path to represent a measurement_protocol_secret resource.

Parameters
Name Description
property string
dataStream string
measurementProtocolSecret string
Returns
Type Description
string The formatted measurement_protocol_secret resource.

static::propertyName

Formats a string containing the fully-qualified path to represent a property resource.

Parameter
Name Description
property string
Returns
Type Description
string The formatted property resource.

static::propertyAccessBindingName

Formats a string containing the fully-qualified path to represent a property_access_binding resource.

Parameters
Name Description
property string
accessBinding string
Returns
Type Description
string The formatted property_access_binding resource.

static::rollupPropertySourceLinkName

Formats a string containing the fully-qualified path to represent a rollup_property_source_link resource.

Parameters
Name Description
property string
rollupPropertySourceLink string
Returns
Type Description
string The formatted rollup_property_source_link resource.

static::sKAdNetworkConversionValueSchemaName

Formats a string containing the fully-qualified path to represent a sk_ad_network_conversion_value_schema resource.

Parameters
Name Description
property string
dataStream string
skadnetworkConversionValueSchema string
Returns
Type Description
string The formatted sk_ad_network_conversion_value_schema resource.

static::searchAds360LinkName

Formats a string containing the fully-qualified path to represent a search_ads360_link resource.

Parameters
Name Description
property string
searchAds360Link string
Returns
Type Description
string The formatted search_ads360_link resource.

static::subpropertyEventFilterName

Formats a string containing the fully-qualified path to represent a subproperty_event_filter resource.

Parameters
Name Description
property string
subPropertyEventFilter string
Returns
Type Description
string The formatted subproperty_event_filter resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • accessBinding: accounts/{account}/accessBindings/{access_binding}
  • account: accounts/{account}
  • accountAccessBinding: accounts/{account}/accessBindings/{access_binding}
  • adSenseLink: properties/{property}/adSenseLinks/{adsense_link}
  • attributionSettings: properties/{property}/attributionSettings
  • audience: properties/{property}/audiences/{audience}
  • bigQueryLink: properties/{property}/bigQueryLinks/{bigquery_link}
  • calculatedMetric: properties/{property}/calculatedMetrics/{calculated_metric}
  • channelGroup: properties/{property}/channelGroups/{channel_group}
  • conversionEvent: properties/{property}/conversionEvents/{conversion_event}
  • customDimension: properties/{property}/customDimensions/{custom_dimension}
  • customMetric: properties/{property}/customMetrics/{custom_metric}
  • dataRedactionSettings: properties/{property}/dataStreams/{data_stream}/dataRedactionSettings
  • dataRetentionSettings: properties/{property}/dataRetentionSettings
  • dataSharingSettings: accounts/{account}/dataSharingSettings
  • dataStream: properties/{property}/dataStreams/{data_stream}
  • displayVideo360AdvertiserLink: properties/{property}/displayVideo360AdvertiserLinks/{display_video_360_advertiser_link}
  • displayVideo360AdvertiserLinkProposal: properties/{property}/displayVideo360AdvertiserLinkProposals/{display_video_360_advertiser_link_proposal}
  • enhancedMeasurementSettings: properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings
  • eventCreateRule: properties/{property}/dataStreams/{data_stream}/eventCreateRules/{event_create_rule}
  • expandedDataSet: properties/{property}/expandedDataSets/{expanded_data_set}
  • firebaseLink: properties/{property}/firebaseLinks/{firebase_link}
  • globalSiteTag: properties/{property}/dataStreams/{data_stream}/globalSiteTag
  • googleAdsLink: properties/{property}/googleAdsLinks/{google_ads_link}
  • googleSignalsSettings: properties/{property}/googleSignalsSettings
  • measurementProtocolSecret: properties/{property}/dataStreams/{data_stream}/measurementProtocolSecrets/{measurement_protocol_secret}
  • property: properties/{property}
  • propertyAccessBinding: properties/{property}/accessBindings/{access_binding}
  • rollupPropertySourceLink: properties/{property}/rollupPropertySourceLinks/{rollup_property_source_link}
  • sKAdNetworkConversionValueSchema: properties/{property}/dataStreams/{data_stream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}
  • searchAds360Link: properties/{property}/searchAds360Links/{search_ads_360_link}
  • subpropertyEventFilter: properties/{property}/subpropertyEventFilters/{sub_property_event_filter}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.analytics.admin.v1alpha.AnalyticsAdminService'

The name of the service.

SERVICE_ADDRESS

Value: 'analyticsadmin.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.