1
1
<?php
2
2
3
- namespace Drupal \commerce_gtm_enhanced_ecommerce \Controller ;
3
+ namespace Drupal \commerce_google_tag_manager \Controller ;
4
4
5
- use Drupal \commerce_gtm_enhanced_ecommerce \EventStorageService ;
5
+ use Drupal \commerce_google_tag_manager \EventStorageService ;
6
6
use Drupal \Core \Controller \ControllerBase ;
7
7
use Symfony \Component \DependencyInjection \ContainerInterface ;
8
8
use Symfony \Component \HttpFoundation \JsonResponse ;
12
12
*
13
13
* Called via ajax on a page load to actually send the tracked events
14
14
* (server-side) to Google Tag Manager.
15
- *
16
- * @package Drupal\commerce_gtm_enhanced_ecommerce
17
15
*/
18
16
class EventsController extends ControllerBase {
19
17
20
18
/**
21
- * @var \Drupal\commerce_gtm_enhanced_ecommerce \EventStorageService
19
+ * @var \Drupal\commerce_google_tag_manager \EventStorageService
22
20
*/
23
- private $ ecommerceEventStorageService ;
21
+ private $ eventStorageService ;
24
22
25
23
/**
26
- * @param \Drupal\commerce_gtm_enhanced_ecommerce \EventStorageService $ecommerceEventStorageService
24
+ * @param \Drupal\commerce_google_tag_manager \EventStorageService $eventStorageService
27
25
*/
28
- public function __construct (EventStorageService $ ecommerceEventStorageService ) {
29
- $ this ->ecommerceEventStorageService = $ ecommerceEventStorageService ;
26
+ public function __construct (EventStorageService $ eventStorageService ) {
27
+ $ this ->eventStorageService = $ eventStorageService ;
30
28
}
31
29
32
30
/**
33
31
* @inheritdoc
34
32
*/
35
33
public static function create (ContainerInterface $ container ) {
36
- return new static ($ container ->get ('commerce_gtm_enhanced_ecommerce .event_storage ' ));
34
+ return new static ($ container ->get ('commerce_google_tag_manager .event_storage ' ));
37
35
}
38
36
39
37
/**
@@ -42,8 +40,8 @@ public static function create(ContainerInterface $container) {
42
40
* @return \Symfony\Component\HttpFoundation\JsonResponse
43
41
*/
44
42
public function getEvents () {
45
- $ events = $ this ->ecommerceEventStorageService ->getEvents ();
46
- $ this ->ecommerceEventStorageService ->flush ();
43
+ $ events = $ this ->eventStorageService ->getEvents ();
44
+ $ this ->eventStorageService ->flush ();
47
45
48
46
return new JsonResponse ($ events );
49
47
}
0 commit comments