File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Algolia \AlgoliaSearch \Observer \Insights ;
4
+
5
+ use Algolia \AlgoliaSearch \Helper \InsightsHelper ;
6
+ use Magento \Customer \Model \Customer ;
7
+ use Magento \Framework \Event \Observer ;
8
+ use Magento \Framework \Event \ObserverInterface ;
9
+
10
+ class CustomerLogout implements ObserverInterface
11
+ {
12
+
13
+ /** @var InsightsHelper */
14
+ protected $ insightsHelper ;
15
+
16
+ /**
17
+ * @param InsightsHelper $insightsHelper
18
+ */
19
+ public function __construct (
20
+ InsightsHelper $ insightsHelper
21
+ )
22
+ {
23
+ $ this ->insightsHelper = $ insightsHelper ;
24
+ }
25
+
26
+ /**
27
+ * @param Observer $observer
28
+ * ['customer' => $customer]
29
+ */
30
+ public function execute (Observer $ observer )
31
+ {
32
+ /** @var Customer $customer */
33
+ $ customer = $ observer ->getEvent ()->getCustomer ();
34
+
35
+ if ($ this ->insightsHelper ->getConfigHelper ()->isClickConversionAnalyticsEnabled ($ customer ->getStoreId ()) || $ this ->insightsHelper ->getPersonalizationHelper ()->isPersoEnabled ($ customer ->getStoreId ())) {
36
+ $ this ->insightsHelper ->unsetUserToken ($ customer );
37
+ }
38
+ }
39
+ }
Original file line number Diff line number Diff line change 23
23
<event name =" checkout_onepage_controller_success_action" >
24
24
<observer name =" algoliasearch_insights_place_order_event" instance =" Algolia\AlgoliaSearch\Observer\Insights\CheckoutOnepageControllerSuccessAction" />
25
25
</event >
26
+ <event name =" customer_logout" >
27
+ <observer name =" algoliasearch_personalization_unset_user_token" instance =" Algolia\AlgoliaSearch\Observer\Insights\CustomerLogout" />
28
+ </event >
26
29
</config >
You can’t perform that action at this time.
0 commit comments