From 458077ada50d809c5569aa73a4c9114c009a4b32 Mon Sep 17 00:00:00 2001 From: Samuel Coman Date: Tue, 5 Sep 2023 12:50:40 +0300 Subject: [PATCH 1/2] Add sign_up event --- DataLayer/Event/SignUp.php | 16 ++++++++++++++ Observer/TriggerSignUpDataLayerEvent.php | 28 ++++++++++++++++++++++++ etc/frontend/events.xml | 4 ++++ 3 files changed, 48 insertions(+) create mode 100644 DataLayer/Event/SignUp.php create mode 100644 Observer/TriggerSignUpDataLayerEvent.php diff --git a/DataLayer/Event/SignUp.php b/DataLayer/Event/SignUp.php new file mode 100644 index 00000000..50d2298a --- /dev/null +++ b/DataLayer/Event/SignUp.php @@ -0,0 +1,16 @@ + 'sign_up', + 'method' => 'Standard' // @TODO: implement mapping based on the route used? + ]; + } +} diff --git a/Observer/TriggerSignUpDataLayerEvent.php b/Observer/TriggerSignUpDataLayerEvent.php new file mode 100644 index 00000000..ba36a817 --- /dev/null +++ b/Observer/TriggerSignUpDataLayerEvent.php @@ -0,0 +1,28 @@ +customerSessionDataProvider = $customerSessionDataProvider; + $this->signUpEvent = $signUpEvent; + } + + public function execute(Observer $observer) + { + $eventData = $this->signUpEvent->get(); + $this->customerSessionDataProvider->add('sign_up_event', $eventData); + } +} \ No newline at end of file diff --git a/etc/frontend/events.xml b/etc/frontend/events.xml index c0a887cd..522ba0cc 100644 --- a/etc/frontend/events.xml +++ b/etc/frontend/events.xml @@ -16,6 +16,10 @@ + + + + From 1c479544e8f8f99b72f9bb64d5a4e61dd0b02877 Mon Sep 17 00:00:00 2001 From: Samuel Coman Date: Tue, 5 Sep 2023 12:52:14 +0300 Subject: [PATCH 2/2] fix end empty line --- Observer/TriggerSignUpDataLayerEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Observer/TriggerSignUpDataLayerEvent.php b/Observer/TriggerSignUpDataLayerEvent.php index ba36a817..4e1a6a7e 100644 --- a/Observer/TriggerSignUpDataLayerEvent.php +++ b/Observer/TriggerSignUpDataLayerEvent.php @@ -25,4 +25,4 @@ public function execute(Observer $observer) $eventData = $this->signUpEvent->get(); $this->customerSessionDataProvider->add('sign_up_event', $eventData); } -} \ No newline at end of file +}