Google Analytics Admin V1alpha Client - Class AnalyticsAdminServiceClient (0.15.1)

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
NameDescription
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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AcknowledgeUserDataCollectionResponse
Example
use Google\Analytics\Admin\V1alpha\AcknowledgeUserDataCollectionResponse;
use Google\Analytics\Admin\V1alpha\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();

    // Call the API and handle any network failures.
    try {
        /** @var AcknowledgeUserDataCollectionResponse $response */
        $response = $analyticsAdminServiceClient->acknowledgeUserDataCollection(
            $formattedProperty,
            $acknowledgement
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ApproveDisplayVideo360AdvertiserLinkProposalResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ApproveDisplayVideo360AdvertiserLinkProposalResponse;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ApproveDisplayVideo360AdvertiserLinkProposalResponse $response */
        $response = $analyticsAdminServiceClient->approveDisplayVideo360AdvertiserLinkProposal(
            $formattedName
        );
        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
NameDescription
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\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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveAudience($formattedName);
        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
NameDescription
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\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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveCustomDimension($formattedName);
        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
NameDescription
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\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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->archiveCustomMetric($formattedName);
        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);
}

Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles.

If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.

Parameters
NameDescription
parent string

Required. Example format: accounts/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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\AuditUserLink;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

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

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

        /** @var AuditUserLink $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]');

    audit_user_links_sample($formattedParent);
}

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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchCreateAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchCreateAccessBindingsResponse;
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 any non-scalar elements to be passed along with the request.
    $requestsAccessBinding = new AccessBinding();
    $createAccessBindingRequest = (new CreateAccessBindingRequest())
        ->setParent($formattedRequestsParent)
        ->setAccessBinding($requestsAccessBinding);
    $requests = [$createAccessBindingRequest,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchCreateAccessBindings($formattedParent, $requests);
        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);
}

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

This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.

Parameters
NameDescription
parent string

Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234

requests array<Google\Analytics\Admin\V1alpha\CreateUserLinkRequest>

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

optionalArgs array

Optional.

↳ notifyNewUsers bool

Optional. If set, then email the new users notifying them that they've been granted permissions to the resource. Regardless of whether this is set or not, notify_new_user field inside each individual request is ignored.

↳ 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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchCreateUserLinksResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchCreateUserLinksResponse;
use Google\Analytics\Admin\V1alpha\CreateUserLinkRequest;
use Google\Analytics\Admin\V1alpha\UserLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent         The account or property that all user links in the request are
 *                                        for. This field is required. The parent field in the CreateUserLinkRequest
 *                                        messages must either be empty or match this field.
 *                                        Example format: accounts/1234
 *                                        Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedRequestsParent Example format: accounts/1234
 *                                        Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function batch_create_user_links_sample(
    string $formattedParent,
    string $formattedRequestsParent
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $requestsUserLink = new UserLink();
    $createUserLinkRequest = (new CreateUserLinkRequest())
        ->setParent($formattedRequestsParent)
        ->setUserLink($requestsUserLink);
    $requests = [$createUserLinkRequest,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateUserLinksResponse $response */
        $response = $analyticsAdminServiceClient->batchCreateUserLinks($formattedParent, $requests);
        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_user_links_sample($formattedParent, $formattedRequestsParent);
}

batchDeleteAccessBindings

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

Parameters
NameDescription
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\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 any non-scalar elements to be passed along with the request.
    $deleteAccessBindingRequest = (new DeleteAccessBindingRequest())
        ->setName($formattedRequestsName);
    $requests = [$deleteAccessBindingRequest,];

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->batchDeleteAccessBindings($formattedParent, $requests);
        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);
}

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

Parameters
NameDescription
parent string

Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234

requests array<Google\Analytics\Admin\V1alpha\DeleteUserLinkRequest>

Required. The requests specifying the user links to update. A maximum of 1000 user links 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.

Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DeleteUserLinkRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The account or property that all user links in the request are
 *                                      for. The parent of all values for user link names to delete must match this
 *                                      field.
 *                                      Example format: accounts/1234
 *                                      Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedRequestsName Example format: accounts/1234/userLinks/5678
 *                                      Please see {@see AnalyticsAdminServiceClient::userLinkName()} for help formatting this field.
 */
function batch_delete_user_links_sample(
    string $formattedParent,
    string $formattedRequestsName
): void {
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $deleteUserLinkRequest = (new DeleteUserLinkRequest())
        ->setName($formattedRequestsName);
    $requests = [$deleteUserLinkRequest,];

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->batchDeleteUserLinks($formattedParent, $requests);
        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::userLinkName('[ACCOUNT]', '[USER_LINK]');

    batch_delete_user_links_sample($formattedParent, $formattedRequestsName);
}

batchGetAccessBindings

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

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchGetAccessBindingsResponse;
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 any non-scalar elements to be passed along with the request.
    $formattedNames = [$formattedNamesElement,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchGetAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchGetAccessBindings($formattedParent, $formattedNames);
        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);
}

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

Parameters
NameDescription
parent string

Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234

names string[]

Required. The names of the user links to retrieve. A maximum of 1000 user links can be retrieved in a batch. Format: accounts/{accountId}/userLinks/{userLinkId}

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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchGetUserLinksResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchGetUserLinksResponse;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The account or property that all user links in the request are
 *                                      for. The parent of all provided values for the 'names' field must match
 *                                      this field.
 *                                      Example format: accounts/1234
 *                                      Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 * @param string $formattedNamesElement The names of the user links to retrieve.
 *                                      A maximum of 1000 user links can be retrieved in a batch.
 *                                      Format: accounts/{accountId}/userLinks/{userLinkId}
 *                                      Please see {@see AnalyticsAdminServiceClient::userLinkName()} for help formatting this field.
 */
function batch_get_user_links_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $formattedNames = [$formattedNamesElement,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchGetUserLinksResponse $response */
        $response = $analyticsAdminServiceClient->batchGetUserLinks($formattedParent, $formattedNames);
        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::userLinkName('[ACCOUNT]', '[USER_LINK]');

    batch_get_user_links_sample($formattedParent, $formattedNamesElement);
}

batchUpdateAccessBindings

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

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchUpdateAccessBindingsResponse;
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 any non-scalar elements to be passed along with the request.
    $requestsAccessBinding = new AccessBinding();
    $updateAccessBindingRequest = (new UpdateAccessBindingRequest())
        ->setAccessBinding($requestsAccessBinding);
    $requests = [$updateAccessBindingRequest,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateAccessBindingsResponse $response */
        $response = $analyticsAdminServiceClient->batchUpdateAccessBindings($formattedParent, $requests);
        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);
}

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

Parameters
NameDescription
parent string

Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234

requests array<Google\Analytics\Admin\V1alpha\UpdateUserLinkRequest>

Required. The requests specifying the user links to update. A maximum of 1000 user links 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
TypeDescription
Google\Analytics\Admin\V1alpha\BatchUpdateUserLinksResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BatchUpdateUserLinksResponse;
use Google\Analytics\Admin\V1alpha\UpdateUserLinkRequest;
use Google\Analytics\Admin\V1alpha\UserLink;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent The account or property that all user links in the request are
 *                                for. The parent field in the UpdateUserLinkRequest messages must either be
 *                                empty or match this field.
 *                                Example format: accounts/1234
 *                                Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field.
 */
function batch_update_user_links_sample(string $formattedParent): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $requestsUserLink = new UserLink();
    $updateUserLinkRequest = (new UpdateUserLinkRequest())
        ->setUserLink($requestsUserLink);
    $requests = [$updateUserLinkRequest,];

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateUserLinksResponse $response */
        $response = $analyticsAdminServiceClient->batchUpdateUserLinks($formattedParent, $requests);
        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_user_links_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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\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();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->cancelDisplayVideo360AdvertiserLinkProposal(
            $formattedName
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $accessBinding = new AccessBinding();

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->createAccessBinding($formattedParent, $accessBinding);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AdSenseLink
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $adsenseLink = new AdSenseLink();

    // Call the API and handle any network failures.
    try {
        /** @var AdSenseLink $response */
        $response = $analyticsAdminServiceClient->createAdSenseLink($formattedParent, $adsenseLink);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause\AudienceClauseType;
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 any non-scalar elements to be passed along with the request.
    $audienceFilterClause = (new AudienceFilterClause())
        ->setClauseType($audienceFilterClausesClauseType);
    $audienceFilterClauses = [$audienceFilterClause,];
    $audience = (new Audience())
        ->setDisplayName($audienceDisplayName)
        ->setDescription($audienceDescription)
        ->setMembershipDurationDays($audienceMembershipDurationDays)
        ->setFilterClauses($audienceFilterClauses);

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->createAudience($formattedParent, $audience);
        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
    );
}

createChannelGroup

Creates a ChannelGroup.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ChannelGroupFilterExpression;
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 any non-scalar elements to be passed along with the request.
    $channelGroupGroupingRuleExpression = new ChannelGroupFilterExpression();
    $groupingRule = (new GroupingRule())
        ->setDisplayName($channelGroupGroupingRuleDisplayName)
        ->setExpression($channelGroupGroupingRuleExpression);
    $channelGroupGroupingRule = [$groupingRule,];
    $channelGroup = (new ChannelGroup())
        ->setDisplayName($channelGroupDisplayName)
        ->setGroupingRule($channelGroupGroupingRule);

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->createChannelGroup($formattedParent, $channelGroup);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CreateConnectedSiteTagResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConnectedSiteTag;
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 any non-scalar elements to be passed along with the request.
    $connectedSiteTag = (new ConnectedSiteTag())
        ->setDisplayName($connectedSiteTagDisplayName)
        ->setTagId($connectedSiteTagTagId);

    // Call the API and handle any network failures.
    try {
        /** @var CreateConnectedSiteTagResponse $response */
        $response = $analyticsAdminServiceClient->createConnectedSiteTag($connectedSiteTag);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ConversionEvent
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
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 any non-scalar elements to be passed along with the request.
    $conversionEvent = new ConversionEvent();

    // Call the API and handle any network failures.
    try {
        /** @var ConversionEvent $response */
        $response = $analyticsAdminServiceClient->createConversionEvent($conversionEvent, $formattedParent);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $customDimension = (new CustomDimension())
        ->setParameterName($customDimensionParameterName)
        ->setDisplayName($customDimensionDisplayName)
        ->setScope($customDimensionScope);

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->createCustomDimension($formattedParent, $customDimension);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $customMetric = (new CustomMetric())
        ->setParameterName($customMetricParameterName)
        ->setDisplayName($customMetricDisplayName)
        ->setMeasurementUnit($customMetricMeasurementUnit)
        ->setScope($customMetricScope);

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->createCustomMetric($formattedParent, $customMetric);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $dataStream = (new DataStream())
        ->setType($dataStreamType);

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->createDataStream($formattedParent, $dataStream);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $displayVideo360AdvertiserLink = new DisplayVideo360AdvertiserLink();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->createDisplayVideo360AdvertiserLink(
            $formattedParent,
            $displayVideo360AdvertiserLink
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $displayVideo360AdvertiserLinkProposal = new DisplayVideo360AdvertiserLinkProposal();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->createDisplayVideo360AdvertiserLinkProposal(
            $formattedParent,
            $displayVideo360AdvertiserLinkProposal
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $matchingCondition = (new MatchingCondition())
        ->setField($eventCreateRuleEventConditionsField)
        ->setComparisonType($eventCreateRuleEventConditionsComparisonType)
        ->setValue($eventCreateRuleEventConditionsValue);
    $eventCreateRuleEventConditions = [$matchingCondition,];
    $eventCreateRule = (new EventCreateRule())
        ->setDestinationEvent($eventCreateRuleDestinationEvent)
        ->setEventConditions($eventCreateRuleEventConditions);

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->createEventCreateRule($formattedParent, $eventCreateRule);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $expandedDataSet = (new ExpandedDataSet())
        ->setDisplayName($expandedDataSetDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->createExpandedDataSet($formattedParent, $expandedDataSet);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\FirebaseLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $firebaseLink = new FirebaseLink();

    // Call the API and handle any network failures.
    try {
        /** @var FirebaseLink $response */
        $response = $analyticsAdminServiceClient->createFirebaseLink($formattedParent, $firebaseLink);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\GoogleAdsLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $googleAdsLink = new GoogleAdsLink();

    // Call the API and handle any network failures.
    try {
        /** @var GoogleAdsLink $response */
        $response = $analyticsAdminServiceClient->createGoogleAdsLink($formattedParent, $googleAdsLink);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $measurementProtocolSecret = (new MeasurementProtocolSecret())
        ->setDisplayName($measurementProtocolSecretDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->createMeasurementProtocolSecret(
            $formattedParent,
            $measurementProtocolSecret
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $property = (new Property())
        ->setDisplayName($propertyDisplayName)
        ->setTimeZone($propertyTimeZone);

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->createProperty($property);
        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);
}

Creates a SearchAds360Link.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $searchAds360Link = new SearchAds360Link();

    // Call the API and handle any network failures.
    try {
        /** @var SearchAds360Link $response */
        $response = $analyticsAdminServiceClient->createSearchAds360Link(
            $formattedParent,
            $searchAds360Link
        );
        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);
}

Creates a user link on an account or property.

If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.

Parameters
NameDescription
parent string

Required. Example format: accounts/1234

userLink Google\Analytics\Admin\V1alpha\UserLink

Required. The user link to create.

optionalArgs array

Optional.

↳ notifyNewUser bool

Optional. If set, then email the new user notifying them that they've been granted permissions to the resource.

↳ 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
TypeDescription
Google\Analytics\Admin\V1alpha\UserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UserLink;
use Google\ApiCore\ApiException;

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

    // Prepare any non-scalar elements to be passed along with the request.
    $userLink = new UserLink();

    // Call the API and handle any network failures.
    try {
        /** @var UserLink $response */
        $response = $analyticsAdminServiceClient->createUserLink($formattedParent, $userLink);
        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_user_link_sample($formattedParent);
}

deleteAccessBinding

Deletes an access binding on an account or property.

Parameters
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAccessBinding($formattedName);
        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, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772

Returns an error if the target is not found.

Parameters
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAccount($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteAdSenseLink($formattedName);
        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);
}

deleteChannelGroup

Deletes a ChannelGroup on a property.

Parameters
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteChannelGroup($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteConnectedSiteTag();
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteConversionEvent($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDataStream($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDisplayVideo360AdvertiserLink($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteDisplayVideo360AdvertiserLinkProposal($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteEventCreateRule($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteExpandedDataSet($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteFirebaseLink($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteGoogleAdsLink($formattedName);
        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
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteMeasurementProtocolSecret($formattedName);
        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, UserLinks) 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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->deleteProperty($formattedName);
        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 SearchAds360Link on a property.

Parameters
NameDescription
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\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteSearchAds360Link($formattedName);
        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);
}

Deletes a user link on an account or property.

Parameters
NameDescription
name string

Required. Example format: accounts/1234/userLinks/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\AnalyticsAdminServiceClient;
use Google\ApiCore\ApiException;

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

    // Call the API and handle any network failures.
    try {
        $analyticsAdminServiceClient->deleteUserLink($formattedName);
        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::userLinkName('[ACCOUNT]', '[USER_LINK]');

    delete_user_link_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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\FetchAutomatedGa4ConfigurationOptOutResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var FetchAutomatedGa4ConfigurationOptOutResponse $response */
        $response = $analyticsAdminServiceClient->fetchAutomatedGa4ConfigurationOptOut($property);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\FetchConnectedGa4PropertyResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var FetchConnectedGa4PropertyResponse $response */
        $response = $analyticsAdminServiceClient->fetchConnectedGa4Property($formattedProperty);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->getAccessBinding($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Account
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var Account $response */
        $response = $analyticsAdminServiceClient->getAccount($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AdSenseLink
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var AdSenseLink $response */
        $response = $analyticsAdminServiceClient->getAdSenseLink($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AttributionSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\AttributionSettings;
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();

    // Call the API and handle any network failures.
    try {
        /** @var AttributionSettings $response */
        $response = $analyticsAdminServiceClient->getAttributionSettings($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Audience;
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();

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->getAudience($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\BigQueryLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
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();

    // Call the API and handle any network failures.
    try {
        /** @var BigQueryLink $response */
        $response = $analyticsAdminServiceClient->getBigQueryLink($formattedName);
        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);
}

getChannelGroup

Lookup for a single ChannelGroup.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->getChannelGroup($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ConversionEvent
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ConversionEvent $response */
        $response = $analyticsAdminServiceClient->getConversionEvent($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
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();

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->getCustomDimension($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
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();

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->getCustomMetric($formattedName);
        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);
}

getDataRetentionSettings

Returns the singleton data retention settings for this property.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataRetentionSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRetentionSettings;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DataRetentionSettings $response */
        $response = $analyticsAdminServiceClient->getDataRetentionSettings($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataSharingSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataSharingSettings;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DataSharingSettings $response */
        $response = $analyticsAdminServiceClient->getDataSharingSettings($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->getDataStream($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->getDisplayVideo360AdvertiserLink($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
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();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLinkProposal $response */
        $response = $analyticsAdminServiceClient->getDisplayVideo360AdvertiserLinkProposal($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings;
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();

    // Call the API and handle any network failures.
    try {
        /** @var EnhancedMeasurementSettings $response */
        $response = $analyticsAdminServiceClient->getEnhancedMeasurementSettings($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
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();

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->getEventCreateRule($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->getExpandedDataSet($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\GlobalSiteTag
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var GlobalSiteTag $response */
        $response = $analyticsAdminServiceClient->getGlobalSiteTag($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\GoogleSignalsSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var GoogleSignalsSettings $response */
        $response = $analyticsAdminServiceClient->getGoogleSignalsSettings($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->getMeasurementProtocolSecret($formattedName);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->getProperty($formattedName);
        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);
}

Look up a single SearchAds360Link

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var SearchAds360Link $response */
        $response = $analyticsAdminServiceClient->getSearchAds360Link($formattedName);
        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);
}

Gets information about a user's link to an account or property.

Parameters
NameDescription
name string

Required. Example format: accounts/1234/userLinks/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
TypeDescription
Google\Analytics\Admin\V1alpha\UserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UserLink;
use Google\ApiCore\ApiException;

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

    // Call the API and handle any network failures.
    try {
        /** @var UserLink $response */
        $response = $analyticsAdminServiceClient->getUserLink($formattedName);
        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::userLinkName('[ACCOUNT]', '[USER_LINK]');

    get_user_link_sample($formattedName);
}

listAccessBindings

Lists all access bindings on an account or property.

Parameters
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AccountSummary;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AdSenseLink;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Audience;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\BigQueryLink;
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();

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

        /** @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);
}

listChannelGroups

Lists ChannelGroups on a property.

Parameters
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ListConnectedSiteTagsResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ListConnectedSiteTagsResponse $response */
        $response = $analyticsAdminServiceClient->listConnectedSiteTags();
        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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ConversionEvent;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLinkProposal;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\FirebaseLink;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleAdsLink;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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 all SearchAds360Links on a property.

Parameters
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

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

        /** @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);
}

Lists all user links on an account or property.

Parameters
NameDescription
parent string

Required. Example format: accounts/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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UserLink;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

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

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

        /** @var UserLink $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_user_links_sample($formattedParent);
}

provisionAccountTicket

Requests a ticket for creating an account.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ProvisionAccountTicketResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var ProvisionAccountTicketResponse $response */
        $response = $analyticsAdminServiceClient->provisionAccountTicket();
        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. The property must be in Google Analytics 360. 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
NameDescription
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.

↳ 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
TypeDescription
Google\Analytics\Admin\V1alpha\RunAccessReportResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var RunAccessReportResponse $response */
        $response = $analyticsAdminServiceClient->runAccessReport();
        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
NameDescription
account string

Required. The account resource for which to return change history resources.

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.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ChangeHistoryEvent;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedAccount The account resource for which to return change history
 *                                 resources. 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();

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

        /** @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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\SetAutomatedGa4ConfigurationOptOutResponse
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var SetAutomatedGa4ConfigurationOptOutResponse $response */
        $response = $analyticsAdminServiceClient->setAutomatedGa4ConfigurationOptOut($property);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AccessBinding
Example
use Google\Analytics\Admin\V1alpha\AccessBinding;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $accessBinding = new AccessBinding();

    // Call the API and handle any network failures.
    try {
        /** @var AccessBinding $response */
        $response = $analyticsAdminServiceClient->updateAccessBinding($accessBinding);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Account
Example
use Google\Analytics\Admin\V1alpha\Account;
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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 any non-scalar elements to be passed along with the request.
    $account = (new Account())
        ->setDisplayName($accountDisplayName);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var Account $response */
        $response = $analyticsAdminServiceClient->updateAccount($account, $updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\AttributionSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
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\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 any non-scalar elements to be passed along with the request.
    $attributionSettings = (new AttributionSettings())
        ->setAcquisitionConversionEventLookbackWindow(
            $attributionSettingsAcquisitionConversionEventLookbackWindow
        )
        ->setOtherConversionEventLookbackWindow($attributionSettingsOtherConversionEventLookbackWindow)
        ->setReportingAttributionModel($attributionSettingsReportingAttributionModel)
        ->setAdsWebConversionDataExportScope($attributionSettingsAdsWebConversionDataExportScope);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var AttributionSettings $response */
        $response = $analyticsAdminServiceClient->updateAttributionSettings(
            $attributionSettings,
            $updateMask
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Audience
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Audience;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause;
use Google\Analytics\Admin\V1alpha\AudienceFilterClause\AudienceClauseType;
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 any non-scalar elements to be passed along with the request.
    $audienceFilterClause = (new AudienceFilterClause())
        ->setClauseType($audienceFilterClausesClauseType);
    $audienceFilterClauses = [$audienceFilterClause,];
    $audience = (new Audience())
        ->setDisplayName($audienceDisplayName)
        ->setDescription($audienceDescription)
        ->setMembershipDurationDays($audienceMembershipDurationDays)
        ->setFilterClauses($audienceFilterClauses);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var Audience $response */
        $response = $analyticsAdminServiceClient->updateAudience($audience, $updateMask);
        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
    );
}

updateChannelGroup

Updates a ChannelGroup.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ChannelGroup
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ChannelGroup;
use Google\Analytics\Admin\V1alpha\ChannelGroupFilterExpression;
use Google\Analytics\Admin\V1alpha\GroupingRule;
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 any non-scalar elements to be passed along with the request.
    $channelGroupGroupingRuleExpression = new ChannelGroupFilterExpression();
    $groupingRule = (new GroupingRule())
        ->setDisplayName($channelGroupGroupingRuleDisplayName)
        ->setExpression($channelGroupGroupingRuleExpression);
    $channelGroupGroupingRule = [$groupingRule,];
    $channelGroup = (new ChannelGroup())
        ->setDisplayName($channelGroupDisplayName)
        ->setGroupingRule($channelGroupGroupingRule);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var ChannelGroup $response */
        $response = $analyticsAdminServiceClient->updateChannelGroup($channelGroup, $updateMask);
        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);
}

updateCustomDimension

Updates a CustomDimension on a property.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomDimension
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomDimension;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var CustomDimension $response */
        $response = $analyticsAdminServiceClient->updateCustomDimension($updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\CustomMetric
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\CustomMetric;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var CustomMetric $response */
        $response = $analyticsAdminServiceClient->updateCustomMetric($updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataRetentionSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataRetentionSettings;
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 any non-scalar elements to be passed along with the request.
    $dataRetentionSettings = new DataRetentionSettings();
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var DataRetentionSettings $response */
        $response = $analyticsAdminServiceClient->updateDataRetentionSettings(
            $dataRetentionSettings,
            $updateMask
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DataStream
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DataStream;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var DataStream $response */
        $response = $analyticsAdminServiceClient->updateDataStream($updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\DisplayVideo360AdvertiserLink;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var DisplayVideo360AdvertiserLink $response */
        $response = $analyticsAdminServiceClient->updateDisplayVideo360AdvertiserLink($updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EnhancedMeasurementSettings;
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 any non-scalar elements to be passed along with the request.
    $enhancedMeasurementSettings = (new EnhancedMeasurementSettings())
        ->setSearchQueryParameter($enhancedMeasurementSettingsSearchQueryParameter);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var EnhancedMeasurementSettings $response */
        $response = $analyticsAdminServiceClient->updateEnhancedMeasurementSettings(
            $enhancedMeasurementSettings,
            $updateMask
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\EventCreateRule
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\EventCreateRule;
use Google\Analytics\Admin\V1alpha\MatchingCondition;
use Google\Analytics\Admin\V1alpha\MatchingCondition\ComparisonType;
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 any non-scalar elements to be passed along with the request.
    $matchingCondition = (new MatchingCondition())
        ->setField($eventCreateRuleEventConditionsField)
        ->setComparisonType($eventCreateRuleEventConditionsComparisonType)
        ->setValue($eventCreateRuleEventConditionsValue);
    $eventCreateRuleEventConditions = [$matchingCondition,];
    $eventCreateRule = (new EventCreateRule())
        ->setDestinationEvent($eventCreateRuleDestinationEvent)
        ->setEventConditions($eventCreateRuleEventConditions);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var EventCreateRule $response */
        $response = $analyticsAdminServiceClient->updateEventCreateRule($eventCreateRule, $updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\ExpandedDataSet
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\ExpandedDataSet;
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 any non-scalar elements to be passed along with the request.
    $expandedDataSet = (new ExpandedDataSet())
        ->setDisplayName($expandedDataSetDisplayName);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var ExpandedDataSet $response */
        $response = $analyticsAdminServiceClient->updateExpandedDataSet($expandedDataSet, $updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\GoogleAdsLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleAdsLink;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var GoogleAdsLink $response */
        $response = $analyticsAdminServiceClient->updateGoogleAdsLink($updateMask);
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\GoogleSignalsSettings
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\GoogleSignalsSettings;
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 any non-scalar elements to be passed along with the request.
    $googleSignalsSettings = new GoogleSignalsSettings();
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var GoogleSignalsSettings $response */
        $response = $analyticsAdminServiceClient->updateGoogleSignalsSettings(
            $googleSignalsSettings,
            $updateMask
        );
        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
NameDescription
measurementProtocolSecret Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret

Required. The measurement protocol secret to update.

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to be updated. Omitted fields will not be updated.

↳ 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
TypeDescription
Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\MeasurementProtocolSecret;
use Google\ApiCore\ApiException;

/**
 * @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 any non-scalar elements to be passed along with the request.
    $measurementProtocolSecret = (new MeasurementProtocolSecret())
        ->setDisplayName($measurementProtocolSecretDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var MeasurementProtocolSecret $response */
        $response = $analyticsAdminServiceClient->updateMeasurementProtocolSecret(
            $measurementProtocolSecret
        );
        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
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\Property
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\Property;
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 any non-scalar elements to be passed along with the request.
    $property = (new Property())
        ->setDisplayName($propertyDisplayName)
        ->setTimeZone($propertyTimeZone);
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var Property $response */
        $response = $analyticsAdminServiceClient->updateProperty($property, $updateMask);
        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);
}

Updates a SearchAds360Link on a property.

Parameters
NameDescription
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
TypeDescription
Google\Analytics\Admin\V1alpha\SearchAds360Link
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\SearchAds360Link;
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 any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

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

Updates a user link on an account or property.

Parameters
NameDescription
userLink Google\Analytics\Admin\V1alpha\UserLink

Required. The user link 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
TypeDescription
Google\Analytics\Admin\V1alpha\UserLink
Example
use Google\Analytics\Admin\V1alpha\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1alpha\UserLink;
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_user_link_sample(): void
{
    // Create a client.
    $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $userLink = new UserLink();

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

static::accessBindingName

Formats a string containing the fully-qualified path to represent a access_binding resource.

Parameters
NameDescription
account string
accessBinding string
Returns
TypeDescription
stringThe formatted access_binding resource.

static::accountName

Formats a string containing the fully-qualified path to represent a account resource.

Parameter
NameDescription
account string
Returns
TypeDescription
stringThe formatted account resource.

static::accountAccessBindingName

Formats a string containing the fully-qualified path to represent a account_access_binding resource.

Parameters
NameDescription
account string
accessBinding string
Returns
TypeDescription
stringThe formatted account_access_binding resource.

static::accountUserLinkName

Formats a string containing the fully-qualified path to represent a account_user_link resource.

Parameters
NameDescription
account string
userLink string
Returns
TypeDescription
stringThe formatted account_user_link resource.

static::adSenseLinkName

Formats a string containing the fully-qualified path to represent a ad_sense_link resource.

Parameters
NameDescription
property string
adsenseLink string
Returns
TypeDescription
stringThe formatted ad_sense_link resource.

static::attributionSettingsName

Formats a string containing the fully-qualified path to represent a attribution_settings resource.

Parameter
NameDescription
property string
Returns
TypeDescription
stringThe formatted attribution_settings resource.

static::audienceName

Formats a string containing the fully-qualified path to represent a audience resource.

Parameters
NameDescription
property string
audience string
Returns
TypeDescription
stringThe formatted audience resource.

static::bigQueryLinkName

Formats a string containing the fully-qualified path to represent a big_query_link resource.

Parameters
NameDescription
property string
bigqueryLink string
Returns
TypeDescription
stringThe formatted big_query_link resource.

static::channelGroupName

Formats a string containing the fully-qualified path to represent a channel_group resource.

Parameters
NameDescription
property string
channelGroup string
Returns
TypeDescription
stringThe formatted channel_group resource.

static::conversionEventName

Formats a string containing the fully-qualified path to represent a conversion_event resource.

Parameters
NameDescription
property string
conversionEvent string
Returns
TypeDescription
stringThe formatted conversion_event resource.

static::customDimensionName

Formats a string containing the fully-qualified path to represent a custom_dimension resource.

Parameters
NameDescription
property string
customDimension string
Returns
TypeDescription
stringThe formatted custom_dimension resource.

static::customMetricName

Formats a string containing the fully-qualified path to represent a custom_metric resource.

Parameters
NameDescription
property string
customMetric string
Returns
TypeDescription
stringThe formatted custom_metric resource.

static::dataRetentionSettingsName

Formats a string containing the fully-qualified path to represent a data_retention_settings resource.

Parameter
NameDescription
property string
Returns
TypeDescription
stringThe formatted data_retention_settings resource.

static::dataSharingSettingsName

Formats a string containing the fully-qualified path to represent a data_sharing_settings resource.

Parameter
NameDescription
account string
Returns
TypeDescription
stringThe formatted data_sharing_settings resource.

static::dataStreamName

Formats a string containing the fully-qualified path to represent a data_stream resource.

Parameters
NameDescription
property string
dataStream string
Returns
TypeDescription
stringThe formatted data_stream resource.

static::displayVideo360AdvertiserLinkName

Formats a string containing the fully-qualified path to represent a display_video360_advertiser_link resource.

Parameters
NameDescription
property string
displayVideo360AdvertiserLink string
Returns
TypeDescription
stringThe 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
NameDescription
property string
displayVideo360AdvertiserLinkProposal string
Returns
TypeDescription
stringThe 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
NameDescription
property string
dataStream string
Returns
TypeDescription
stringThe formatted enhanced_measurement_settings resource.

static::eventCreateRuleName

Formats a string containing the fully-qualified path to represent a event_create_rule resource.

Parameters
NameDescription
property string
dataStream string
eventCreateRule string
Returns
TypeDescription
stringThe formatted event_create_rule resource.

static::expandedDataSetName

Formats a string containing the fully-qualified path to represent a expanded_data_set resource.

Parameters
NameDescription
property string
expandedDataSet string
Returns
TypeDescription
stringThe formatted expanded_data_set resource.

static::firebaseLinkName

Formats a string containing the fully-qualified path to represent a firebase_link resource.

Parameters
NameDescription
property string
firebaseLink string
Returns
TypeDescription
stringThe formatted firebase_link resource.

static::globalSiteTagName

Formats a string containing the fully-qualified path to represent a global_site_tag resource.

Parameters
NameDescription
property string
dataStream string
Returns
TypeDescription
stringThe formatted global_site_tag resource.

static::googleAdsLinkName

Formats a string containing the fully-qualified path to represent a google_ads_link resource.

Parameters
NameDescription
property string
googleAdsLink string
Returns
TypeDescription
stringThe formatted google_ads_link resource.

static::googleSignalsSettingsName

Formats a string containing the fully-qualified path to represent a google_signals_settings resource.

Parameter
NameDescription
property string
Returns
TypeDescription
stringThe formatted google_signals_settings resource.

static::measurementProtocolSecretName

Formats a string containing the fully-qualified path to represent a measurement_protocol_secret resource.

Parameters
NameDescription
property string
dataStream string
measurementProtocolSecret string
Returns
TypeDescription
stringThe formatted measurement_protocol_secret resource.

static::propertyName

Formats a string containing the fully-qualified path to represent a property resource.

Parameter
NameDescription
property string
Returns
TypeDescription
stringThe formatted property resource.

static::propertyAccessBindingName

Formats a string containing the fully-qualified path to represent a property_access_binding resource.

Parameters
NameDescription
property string
accessBinding string
Returns
TypeDescription
stringThe formatted property_access_binding resource.

static::propertyUserLinkName

Formats a string containing the fully-qualified path to represent a property_user_link resource.

Parameters
NameDescription
property string
userLink string
Returns
TypeDescription
stringThe formatted property_user_link resource.

static::searchAds360LinkName

Formats a string containing the fully-qualified path to represent a search_ads360_link resource.

Parameters
NameDescription
property string
searchAds360Link string
Returns
TypeDescription
stringThe formatted search_ads360_link resource.

static::userLinkName

Formats a string containing the fully-qualified path to represent a user_link resource.

Parameters
NameDescription
account string
userLink string
Returns
TypeDescription
stringThe formatted user_link 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}
  • accountUserLink: accounts/{account}/userLinks/{user_link}
  • adSenseLink: properties/{property}/adSenseLinks/{adsense_link}
  • attributionSettings: properties/{property}/attributionSettings
  • audience: properties/{property}/audiences/{audience}
  • bigQueryLink: properties/{property}/bigQueryLinks/{bigquery_link}
  • channelGroup: properties/{property}/channelGroups/{channel_group}
  • conversionEvent: properties/{property}/conversionEvents/{conversion_event}
  • customDimension: properties/{property}/customDimensions/{custom_dimension}
  • customMetric: properties/{property}/customMetrics/{custom_metric}
  • 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}
  • propertyUserLink: properties/{property}/userLinks/{user_link}
  • searchAds360Link: properties/{property}/searchAds360Links/{search_ads_360_link}
  • userLink: accounts/{account}/userLinks/{user_link}

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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn 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.