HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/SiteClaimEvents.php.tar
httpdocs/wp-content/plugins/google-listings-and-ads/src/Tracking/Events/SiteClaimEvents.php000064400000005725151550327630034413 0ustar00var/www/vhosts/uyarreklam.com.tr<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

/**
 * This class adds actions to track for Site Claim actions:
 * - Site claim required
 * - Site claim success
 * - Site claim failure
 * - Merchant Center URL switch
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
class SiteClaimEvents extends BaseEvent {

	/**
	 * Register the tracking class.
	 */
	public function register(): void {
		add_action( 'woocommerce_gla_site_claim_overwrite_required', [ $this, 'track_site_claim_overwrite_required' ] );
		add_action( 'woocommerce_gla_site_claim_success', [ $this, 'track_site_claim_success' ] );
		add_action( 'woocommerce_gla_site_claim_failure', [ $this, 'track_site_claim_failure' ] );
		add_action( 'woocommerce_gla_url_switch_required', [ $this, 'track_url_switch_required' ] );
		add_action( 'woocommerce_gla_url_switch_success', [ $this, 'track_url_switch_success' ] );
	}

	/**
	 * Track when a site claim needs to be overwritten.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_overwrite_required( array $properties = [] ): void {
		$properties['action'] = 'overwrite_required';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track when a site is claimed successfully.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_success( array $properties = [] ): void {
		$properties['action'] = 'success';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track when a site fails to be claimed.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_failure( array $properties = [] ): void {
		$properties['action'] = 'failure';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track the generic site claim event with the action property.
	 *
	 * @param array $properties
	 */
	protected function track_site_claim_event( array $properties = [] ): void {
		$this->record_event( 'site_claim', $properties );
	}

	/**
	 * Track when a site requires a URL switch
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_url_switch_required( array $properties = [] ): void {
		$properties['action'] = 'required';
		$this->track_url_switch_event( $properties );
	}

	/**
	 * Track when a site executes a successful URL switch
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_url_switch_success( array $properties = [] ): void {
		$properties['action'] = 'success';
		$this->track_url_switch_event( $properties );
	}

	/**
	 * Track the generic url switch event with the action property.
	 *
	 * @param array $properties
	 */
	protected function track_url_switch_event( array $properties = [] ): void {
		$this->record_event( 'mc_url_switch', $properties );
	}
}