-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from samicoman/master
sign_up event
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Yireo\GoogleTagManager2\DataLayer\Event; | ||
|
||
use Yireo\GoogleTagManager2\Api\Data\EventInterface; | ||
|
||
class SignUp implements EventInterface | ||
{ | ||
public function get(): array | ||
{ | ||
return [ | ||
'event' => 'sign_up', | ||
'method' => 'Standard' // @TODO: implement mapping based on the route used? | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Yireo\GoogleTagManager2\Observer; | ||
|
||
use Magento\Framework\Event\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
use Yireo\GoogleTagManager2\Api\CustomerSessionDataProviderInterface; | ||
use Yireo\GoogleTagManager2\DataLayer\Event\SignUp as SignUpEvent; | ||
|
||
class TriggerSignUpDataLayerEvent implements ObserverInterface | ||
{ | ||
private CustomerSessionDataProviderInterface $customerSessionDataProvider; | ||
private SignUpEvent $signUpEvent; | ||
|
||
public function __construct( | ||
CustomerSessionDataProviderInterface $customerSessionDataProvider, | ||
SignUpEvent $signUpEvent | ||
) { | ||
$this->customerSessionDataProvider = $customerSessionDataProvider; | ||
$this->signUpEvent = $signUpEvent; | ||
} | ||
|
||
public function execute(Observer $observer) | ||
{ | ||
$eventData = $this->signUpEvent->get(); | ||
$this->customerSessionDataProvider->add('sign_up_event', $eventData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters