@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | // so we can't extract it from the passed in $config |
40 | 40 | $majorVersion = '4'; |
41 | 41 | // Dev server container name & port are based on the major version of this plugin |
42 | - $devPort = 3000 + (int)$majorVersion; |
|
43 | - $versionName = 'v' . $majorVersion; |
|
42 | + $devPort = 3000 + (int) $majorVersion; |
|
43 | + $versionName = 'v'.$majorVersion; |
|
44 | 44 | return [ |
45 | 45 | 'components' => [ |
46 | 46 | 'ga4' => Ga4::class, |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | 'assetClass' => InstantAnalyticsAsset::class, |
51 | 51 | 'checkDevServer' => true, |
52 | 52 | 'class' => VitePluginService::class, |
53 | - 'devServerInternal' => 'http://craft-instantanalytics-ga4-' . $versionName . '-buildchain-dev:' . $devPort, |
|
54 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
53 | + 'devServerInternal' => 'http://craft-instantanalytics-ga4-'.$versionName.'-buildchain-dev:'.$devPort, |
|
54 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
55 | 55 | 'errorEntry' => 'src/js/app.ts', |
56 | 56 | 'useDevServer' => true, |
57 | 57 | ], |
@@ -380,7 +380,7 @@ |
||
380 | 380 | }); |
381 | 381 | |
382 | 382 | // Check to make sure Order::EVENT_AFTER_REMOVE_LINE_ITEM is defined |
383 | - if (defined(Order::class . '::EVENT_AFTER_REMOVE_LINE_ITEM')) { |
|
383 | + if (defined(Order::class.'::EVENT_AFTER_REMOVE_LINE_ITEM')) { |
|
384 | 384 | Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function(LineItemEvent $e): void { |
385 | 385 | $lineItem = $e->lineItem; |
386 | 386 | if (self::$settings->autoSendRemoveFromCart) { |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | return static function(ECSConfig $ecsConfig): void { |
7 | 7 | $ecsConfig->paths([ |
8 | - __DIR__ . '/src', |
|
8 | + __DIR__.'/src', |
|
9 | 9 | __FILE__, |
10 | 10 | ]); |
11 | 11 | $ecsConfig->parallel(); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param Product|Variant|null $productVariant the Product or Variant |
133 | 133 | * @throws InvalidConfigException |
134 | 134 | */ |
135 | - public function addCommerceProductImpression(Variant|Product|null $productVariant): void |
|
135 | + public function addCommerceProductImpression(Variant | Product | null $productVariant): void |
|
136 | 136 | { |
137 | 137 | if ($productVariant) { |
138 | 138 | $event = InstantAnalytics::$plugin->ga4->getAnalytics()->create()->ViewItemEvent(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $eventItem->setItemId($variant->sku); |
315 | 315 | $eventItem->setItemName($variant->title); |
316 | - $eventItem->setPrice((float)number_format($variant->price, 2, '.', '')); |
|
316 | + $eventItem->setPrice((float) number_format($variant->price, 2, '.', '')); |
|
317 | 317 | |
318 | 318 | $category = ($isVariant ? $variant->getProduct() : $productVariant)->getType()['name']; |
319 | 319 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $name = $cat->title; |
431 | 431 | |
432 | 432 | while ($cat = $cat->parent) { |
433 | - $name = $cat->title . '/' . $name; |
|
433 | + $name = $cat->title.'/'.$name; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | $cats[] = $name; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | ]; |
82 | 82 | |
83 | 83 | if (!array_key_exists($componentName, $componentMap)) { |
84 | - throw new \InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - ' . $componentName)); |
|
84 | + throw new \InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - '.$componentName)); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return new $componentMap[$componentName](); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param string $listName |
207 | 207 | * @throws InvalidConfigException |
208 | 208 | */ |
209 | - public function addCommerceProductImpression(Product|Variant $productVariant, int $index = 0, string $listName = 'default') |
|
209 | + public function addCommerceProductImpression(Product | Variant $productVariant, int $index = 0, string $listName = 'default') |
|
210 | 210 | { |
211 | 211 | InstantAnalytics::$plugin->commerce->addCommerceProductImpression($productVariant); |
212 | 212 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @throws InvalidConfigException |
231 | 231 | * @deprecated `Analytics::addCommerceProductDetailView()` is deprecated. Use `Analytics::addCommerceProductImpression()` instead. |
232 | 232 | */ |
233 | - public function addCommerceProductDetailView(Product|Variant $productVariant, int $index = 0, string $listName = 'default') |
|
233 | + public function addCommerceProductDetailView(Product | Variant $productVariant, int $index = 0, string $listName = 'default') |
|
234 | 234 | { |
235 | 235 | Craft::$app->getDeprecator()->log('Analytics::addCommerceProductDetailView()', '`Analytics::addCommerceProductDetailView()` is deprecated. Use `Analytics::addCommerceProductImpression()` instead.'); |
236 | 236 | $this->addCommerceProductImpression($productVariant); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // Load them up for GA4 |
388 | 388 | foreach ($campaignParams as $key => $method) { |
389 | 389 | $value = $request->getParam($key) ?? $session->get($key) ?? null; |
390 | - $method = 'set' . $method; |
|
390 | + $method = 'set'.$method; |
|
391 | 391 | |
392 | 392 | $this->$method($value); |
393 | 393 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | // Protected Properties |
26 | 26 | // ========================================================================= |
27 | 27 | |
28 | - protected array|bool|int $allowAnonymous = [ |
|
28 | + protected array | bool | int $allowAnonymous = [ |
|
29 | 29 | 'track-page-view-url', |
30 | 30 | 'track-event-url', |
31 | 31 | ]; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $urlParts = parse_url($url); |
73 | 73 | $url = $urlParts['path'] ?? '/'; |
74 | 74 | if (isset($urlParts['query'])) { |
75 | - $url .= '?' . $urlParts['query']; |
|
75 | + $url .= '?'.$urlParts['query']; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $path = parse_url($url, PHP_URL_PATH); |
114 | 114 | $pathFragments = explode('/', rtrim($path, '/')); |
115 | 115 | $fileName = end($pathFragments); |
116 | - $trackingUrl = UrlHelper::siteUrl('instantanalytics/pageViewTrack/' . $fileName, $urlParams); |
|
116 | + $trackingUrl = UrlHelper::siteUrl('instantanalytics/pageViewTrack/'.$fileName, $urlParams); |
|
117 | 117 | |
118 | 118 | InstantAnalytics::$plugin->logAnalyticsEvent( |
119 | 119 | 'Created pageViewTrackingUrl for: {trackingUrl}', |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $urlParams = compact('url', 'eventName', 'params'); |
144 | 144 | |
145 | 145 | $fileName = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_BASENAME); |
146 | - $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/' . $fileName, $urlParams); |
|
146 | + $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/'.$fileName, $urlParams); |
|
147 | 147 | |
148 | 148 | InstantAnalytics::$plugin->logAnalyticsEvent( |
149 | 149 | 'Created eventTrackingUrl for: {trackingUrl}', |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $cid = $_COOKIE['_ia']; |
276 | 276 | } else { |
277 | 277 | // Generate our own client id, otherwise. |
278 | - $cid = static::gaGenUUID() . '.1'; |
|
278 | + $cid = static::gaGenUUID().'.1'; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | if (InstantAnalytics::$settings->createGclidCookie && !empty($cid)) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | $sessionString = ''; |
296 | 296 | $measurementId = App::parseEnv(InstantAnalytics::$settings->googleAnalyticsMeasurementId); |
297 | - $cookieName = '_ga_' . StringHelper::removeLeft($measurementId, 'G-'); |
|
297 | + $cookieName = '_ga_'.StringHelper::removeLeft($measurementId, 'G-'); |
|
298 | 298 | |
299 | 299 | if (isset($_COOKIE[$cookieName])) { |
300 | 300 | $parts = explode(".", $_COOKIE[$cookieName], 5); |
@@ -192,7 +192,7 @@ |
||
192 | 192 | $prefix = $global->handle; |
193 | 193 | $fields = array_combine( |
194 | 194 | array_map(static function($key) use ($prefix) { |
195 | - return $prefix . '.' . $key; |
|
195 | + return $prefix.'.'.$key; |
|
196 | 196 | }, array_keys($fields)), |
197 | 197 | $fields |
198 | 198 | ); |