@@ -40,13 +40,14 @@ public function track($event, $properties = [])
40
40
$ browserInfo = new Browser ();
41
41
$ osInfo = new Os ();
42
42
$ deviceInfo = new Device ();
43
- $ osVersion = $ osInfo ->getName () . ' ' . $ osInfo ->getVersion ();
44
- $ hardware = $ deviceInfo ->getName () . ' ' . $ deviceInfo ->getVersion ();
43
+ $ browserVersion = trim (str_replace ('unknown ' , '' , $ browserInfo ->getName () . ' ' . $ browserInfo ->getVersion ()));
44
+ $ osVersion = trim (str_replace ('unknown ' , '' , $ osInfo ->getName () . ' ' . $ osInfo ->getVersion ()));
45
+ $ hardwareVersion = trim (str_replace ('unknown ' , '' , $ deviceInfo ->getName () . ' ' . $ deviceInfo ->getVersion ()));
45
46
$ data = [
46
47
'Url ' => $ this ->request ->getUri (),
47
48
'Operating System ' => $ osVersion ,
48
- 'Hardware ' => $ hardware ,
49
- '$browser ' => $ browserInfo -> getName () . ' ' . $ browserInfo -> getVersion () ,
49
+ 'Hardware ' => $ hardwareVersion ,
50
+ '$browser ' => $ browserVersion ,
50
51
'Referrer ' => $ this ->request ->header ('referer ' ),
51
52
'$referring_domain ' => ($ this ->request ->header ('referer ' )
52
53
? parse_url ($ this ->request ->header ('referer ' ))['host ' ]
@@ -55,8 +56,11 @@ public function track($event, $properties = [])
55
56
];
56
57
array_filter ($ data );
57
58
array_filter ($ properties );
58
- $ properties = $ data + $ properties ;
59
59
60
- parent ::track ($ event , $ properties );
60
+ if ((! array_key_exists ('$browser ' , $ data )) && $ browserInfo ->isRobot ()) {
61
+ $ data ['$browser ' ] = 'Robot ' ;
62
+ }
63
+
64
+ parent ::track ($ event , $ data + $ properties );
61
65
}
62
66
}
0 commit comments