File tree Expand file tree Collapse file tree 3 files changed +75
-5
lines changed
Expand file tree Collapse file tree 3 files changed +75
-5
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace AlexWestergaard \PhpGa4 \Event ;
4+
5+ use AlexWestergaard \PhpGa4 \Helper \EventHelper ;
6+ use AlexWestergaard \PhpGa4 \Facade ;
7+
8+ class PageView extends EventHelper implements Facade \Type \DefaultEventParamsType
9+ {
10+ protected null |string $ method ;
11+
12+ public function getName (): string
13+ {
14+ return 'page_view ' ;
15+ }
16+
17+ public function getParams (): array
18+ {
19+ return [
20+ 'language ' ,
21+ 'page_location ' ,
22+ 'page_referrer ' ,
23+ 'page_title ' ,
24+ 'screen_resolution ' ,
25+ ];
26+ }
27+
28+ public function getRequiredParams (): array
29+ {
30+ return [
31+ 'page_title ' ,
32+ 'page_location ' ,
33+ ];
34+ }
35+ }
Original file line number Diff line number Diff line change 44
55interface DefaultEventParamsType
66{
7- /** @var language */
7+ /**
8+ * The language of the website
9+ *
10+ * @var language
11+ * @param string $method eg. en-US
12+ */
813 public function setLanguage (string $ lang );
914
10- /** @var page_location */
15+ /**
16+ * Current url of the website
17+ *
18+ * @var page_location
19+ * @param string $url eg. http://mysite.com
20+ */
1121 public function setPageLocation (string $ url );
1222
13- /** @var page_referrer */
23+ /**
24+ * Current url of the website
25+ *
26+ * @var page_referrer
27+ * @param string $url eg. http://searchengine.com/?q=mysite.com
28+ */
1429 public function setPageReferrer (string $ url );
1530
16- /** @var page_title */
31+ /**
32+ * Current url of the website
33+ *
34+ * @var page_title
35+ * @param string $title eg. "My website"
36+ */
1737 public function setPageTitle (string $ title );
1838
19- /** @var screen_resolution */
39+ /**
40+ * Current url of the website
41+ *
42+ * @var screen_resolution
43+ * @param string $title eg. "1920x1080" for 1920px width and 1080px height
44+ */
2045 public function setScreenResolution (string $ wxh );
2146
2247 public function toArray (): array ;
Original file line number Diff line number Diff line change 1313
1414final class EventTest extends TestCase
1515{
16+ public function test_pageview ()
17+ {
18+ $ event = new Event \PageView ;
19+
20+ $ this ->assertEventNaming ($ event );
21+ $ this ->assertEventFills ($ this ->populateEventByMethod (clone $ event ));
22+ $ this ->assertEventFills ($ this ->populateEventByArrayable (clone $ event ));
23+ $ this ->assertEventFills ($ this ->populateEventByFromArray (clone $ event ));
24+ }
25+
1626 public function test_addpaymentinfo ()
1727 {
1828 $ event = new Event \AddPaymentInfo ;
You can’t perform that action at this time.
0 commit comments