<?php
declare(strict_types=1);
namespace Tanmar\GoogleAdsTracking\Components;
use Shopware\Core\Framework\Struct\Struct;
class GoogleAdsData extends Struct {
protected bool $active;
protected bool $retargetingActive;
protected string $conversionId;
protected string $conversionLabel;
protected string $eventName;
protected array $eventData;
public function __construct() {
$this->active = false;
$this->retargetingActive = false;
$this->conversionId = '';
$this->conversionLabel = '';
$this->eventName = '';
$this->eventData = array();
}
public function getActive(): bool {
return $this->active;
}
public function getRetargetingActive(): bool {
return $this->retargetingActive;
}
public function getConversionId(): string {
return $this->checkConversionId($this->conversionId);
}
public function getConversionLabel(): string {
return $this->conversionLabel;
}
public function getEventName(): string {
return $this->eventName;
}
public function getEventData(): array {
return $this->eventData;
}
/**
*
* @param string $conversionId
* @return string
*/
private function checkConversionId(string $conversionId): string {
$conversionId = preg_replace('#[^0-9]#', '', $conversionId);
$conversionId = ($conversionId != '') ? ('AW-' . $conversionId) : $conversionId;
return $conversionId;
}
}