feat: tracking integration with GTM and CMP
This commit is contained in:
+31
-2
@@ -9,6 +9,7 @@ use App\EventListener\DomainThemeListener;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\CreateFieldStateProvider;
|
||||
use App\Form\Service\EditFieldStateProvider;
|
||||
use App\Model\DomainConfig;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
@@ -234,14 +235,42 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
* Defaults to 'base' if no theme is set.
|
||||
*/
|
||||
public function getBookingTheme(): string
|
||||
{
|
||||
return $this->getDomainConfig()->theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the GTM container ID for the current domain.
|
||||
*
|
||||
* Returns an empty string if no GTM ID is configured for this domain.
|
||||
*/
|
||||
public function getGtmId(): string
|
||||
{
|
||||
return $this->getDomainConfig()->gtmId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CMP (Consent Management Platform) URL for the current domain.
|
||||
*
|
||||
* Returns an empty string if no CMP URL is configured for this domain.
|
||||
*/
|
||||
public function getCmpUrl(): string
|
||||
{
|
||||
return $this->getDomainConfig()->cmpUrl;
|
||||
}
|
||||
|
||||
private function getDomainConfig(): DomainConfig
|
||||
{
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
if (null === $request) {
|
||||
return 'base';
|
||||
return DomainConfig::default();
|
||||
}
|
||||
|
||||
return $request->attributes->get(DomainThemeListener::THEME_ATTRIBUTE, 'base');
|
||||
return $request->attributes->get(
|
||||
DomainThemeListener::DOMAIN_CONFIG_ATTRIBUTE,
|
||||
DomainConfig::default()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user