@@ -385,7 +385,7 @@ |
||
| 385 | 385 | $name = $cat->title; |
| 386 | 386 | |
| 387 | 387 | while ($cat = $cat->parent) { |
| 388 | - $name = $cat->title . '/' . $name; |
|
| 388 | + $name = $cat->title.'/'.$name; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $cats[] = $name; |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | ]; |
| 83 | 83 | |
| 84 | 84 | if (!array_key_exists($componentName, $componentMap)) { |
| 85 | - throw new InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - ' . $componentName)); |
|
| 85 | + throw new InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - '.$componentName)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return new $componentMap[$componentName]; |
@@ -352,7 +352,7 @@ |
||
| 352 | 352 | // Load them up for GA4 |
| 353 | 353 | foreach ($campaignParams as $key => $method) { |
| 354 | 354 | $value = $request->getParam($key) ?? $session->get($key) ?? null; |
| 355 | - $method = 'set' . $method; |
|
| 355 | + $method = 'set'.$method; |
|
| 356 | 356 | |
| 357 | 357 | $this->$method($value); |
| 358 | 358 | |
@@ -190,7 +190,7 @@ |
||
| 190 | 190 | // Prefix the keys with the global set name |
| 191 | 191 | $prefix = $global->handle; |
| 192 | 192 | $fields = array_combine( |
| 193 | - array_map(function ($key) use ($prefix) { |
|
| 193 | + array_map(function($key) use ($prefix) { |
|
| 194 | 194 | return $prefix.'.'.$key; |
| 195 | 195 | }, array_keys($fields)), |
| 196 | 196 | $fields |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | Event::on( |
| 246 | 246 | CraftVariable::class, |
| 247 | 247 | CraftVariable::EVENT_INIT, |
| 248 | - function (Event $event): void { |
|
| 248 | + function(Event $event): void { |
|
| 249 | 249 | /** @var CraftVariable $variable */ |
| 250 | 250 | $variable = $event->sender; |
| 251 | 251 | $variable->set('instantAnalytics', [ |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | Event::on( |
| 266 | 266 | Plugins::class, |
| 267 | 267 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 268 | - function (PluginEvent $event): void { |
|
| 268 | + function(PluginEvent $event): void { |
|
| 269 | 269 | if ($event->plugin === $this) { |
| 270 | 270 | $request = Craft::$app->getRequest(); |
| 271 | 271 | if ($request->isCpRequest) { |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | Event::on( |
| 280 | 280 | Plugins::class, |
| 281 | 281 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
| 282 | - function (Event $event): void { |
|
| 282 | + function(Event $event): void { |
|
| 283 | 283 | // Determine if Craft Commerce is installed & enabled |
| 284 | 284 | self::$commercePlugin = Craft::$app->getPlugins()->getPlugin(self::COMMERCE_PLUGIN_HANDLE); |
| 285 | 285 | // Determine if SEOmatic is installed & enabled |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | Event::on( |
| 310 | 310 | UrlManager::class, |
| 311 | 311 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 312 | - function (RegisterUrlRulesEvent $event): void { |
|
| 312 | + function(RegisterUrlRulesEvent $event): void { |
|
| 313 | 313 | Craft::debug( |
| 314 | 314 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 315 | 315 | __METHOD__ |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | Event::on( |
| 326 | 326 | View::class, |
| 327 | 327 | View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE, |
| 328 | - static function (TemplateEvent $event): void { |
|
| 328 | + static function(TemplateEvent $event): void { |
|
| 329 | 329 | self::$currentTemplate = $event->template; |
| 330 | 330 | } |
| 331 | 331 | ); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | Event::on( |
| 334 | 334 | View::class, |
| 335 | 335 | View::EVENT_AFTER_RENDER_PAGE_TEMPLATE, |
| 336 | - function (TemplateEvent $event): void { |
|
| 336 | + function(TemplateEvent $event): void { |
|
| 337 | 337 | if (self::$settings->autoSendPageView) { |
| 338 | 338 | $request = Craft::$app->getRequest(); |
| 339 | 339 | if (!$request->getIsAjax()) { |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | Event::on( |
| 348 | 348 | Response::class, |
| 349 | 349 | Response::EVENT_BEFORE_SEND, |
| 350 | - function (Event $event): void { |
|
| 350 | + function(Event $event): void { |
|
| 351 | 351 | // Initialize this sooner rather than later, since it's possible this will want to tinker with cookies |
| 352 | 352 | $this->ga4->getAnalytics(); |
| 353 | 353 | } |
@@ -357,21 +357,21 @@ discard block |
||
| 357 | 357 | Event::on( |
| 358 | 358 | Response::class, |
| 359 | 359 | Response::EVENT_AFTER_SEND, |
| 360 | - function (Event $event): void { |
|
| 360 | + function(Event $event): void { |
|
| 361 | 361 | $this->ga4->getAnalytics()->sendCollectedEvents(); |
| 362 | 362 | } |
| 363 | 363 | ); |
| 364 | 364 | |
| 365 | 365 | // Commerce-specific hooks |
| 366 | 366 | if (self::$commercePlugin !== null) { |
| 367 | - Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function (Event $e): void { |
|
| 367 | + Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e): void { |
|
| 368 | 368 | $order = $e->sender; |
| 369 | 369 | if (self::$settings->autoSendPurchaseComplete) { |
| 370 | 370 | $this->commerce->triggerOrderCompleteEvent($order); |
| 371 | 371 | } |
| 372 | 372 | }); |
| 373 | 373 | |
| 374 | - Event::on(Order::class, Order::EVENT_AFTER_ADD_LINE_ITEM, function (LineItemEvent $e): void { |
|
| 374 | + Event::on(Order::class, Order::EVENT_AFTER_ADD_LINE_ITEM, function(LineItemEvent $e): void { |
|
| 375 | 375 | $lineItem = $e->lineItem; |
| 376 | 376 | if (self::$settings->autoSendAddToCart) { |
| 377 | 377 | $this->commerce->triggerAddToCartEvent($lineItem); |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | }); |
| 380 | 380 | |
| 381 | 381 | // Check to make sure Order::EVENT_AFTER_REMOVE_LINE_ITEM is defined |
| 382 | - if (defined(Order::class . '::EVENT_AFTER_REMOVE_LINE_ITEM')) { |
|
| 383 | - Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function (LineItemEvent $e): void { |
|
| 382 | + if (defined(Order::class.'::EVENT_AFTER_REMOVE_LINE_ITEM')) { |
|
| 383 | + Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function(LineItemEvent $e): void { |
|
| 384 | 384 | $lineItem = $e->lineItem; |
| 385 | 385 | if (self::$settings->autoSendRemoveFromCart) { |
| 386 | 386 | $this->commerce->triggerRemoveFromCartEvent($lineItem); |
@@ -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}', |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $urlParams = compact('url', 'eventName', 'params'); |
| 145 | 145 | |
| 146 | 146 | $fileName = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_BASENAME); |
| 147 | - $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/' . $fileName, $urlParams); |
|
| 147 | + $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/'.$fileName, $urlParams); |
|
| 148 | 148 | |
| 149 | 149 | InstantAnalytics::$plugin->logAnalyticsEvent( |
| 150 | 150 | 'Created eventTrackingUrl for: {trackingUrl}', |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $result = true; |
| 169 | 169 | $request = Craft::$app->getRequest(); |
| 170 | 170 | |
| 171 | - $logExclusion = static function (string $setting) |
|
| 171 | + $logExclusion = static function(string $setting) |
|
| 172 | 172 | { |
| 173 | 173 | if (InstantAnalytics::$settings->logExcludedAnalytics) { |
| 174 | 174 | $request = Craft::$app->getRequest(); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $cid = $_COOKIE['_ia']; |
| 278 | 278 | } else { |
| 279 | 279 | // Generate our own client id, otherwise. |
| 280 | - $cid = static::gaGenUUID() . '.1'; |
|
| 280 | + $cid = static::gaGenUUID().'.1'; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | if (InstantAnalytics::$settings->createGclidCookie && !empty($cid)) { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $sessionString = ''; |
| 298 | 298 | $measurementId = Craft::parseEnv(InstantAnalytics::$settings->googleAnalyticsMeasurementId); |
| 299 | - $cookieName = '_ga_' . StringHelper::removeLeft($measurementId, 'G-'); |
|
| 299 | + $cookieName = '_ga_'.StringHelper::removeLeft($measurementId, 'G-'); |
|
| 300 | 300 | |
| 301 | 301 | if (isset($_COOKIE[$cookieName])) { |
| 302 | 302 | $parts = explode(".", $_COOKIE[$cookieName], 5); |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | // so we can't extract it from the passed in $config |
| 34 | 34 | $majorVersion = '3'; |
| 35 | 35 | // Dev server container name & port are based on the major version of this plugin |
| 36 | - $devPort = 3000 + (int)$majorVersion; |
|
| 37 | - $versionName = 'v' . $majorVersion; |
|
| 36 | + $devPort = 3000 + (int) $majorVersion; |
|
| 37 | + $versionName = 'v'.$majorVersion; |
|
| 38 | 38 | // Merge in the passed config, so it our config can be overridden by Plugins::pluginConfigs['vite'] |
| 39 | 39 | // ref: https://github.com/craftcms/cms/issues/1989 |
| 40 | 40 | $config = ArrayHelper::merge([ |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | 'assetClass' => InstantAnalyticsAsset::class, |
| 47 | 47 | 'checkDevServer' => true, |
| 48 | 48 | 'class' => VitePluginService::class, |
| 49 | - 'devServerInternal' => 'http://craft-instantanalytics-ga4-' . $versionName . '-buildchain-dev:' . $devPort, |
|
| 50 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
| 49 | + 'devServerInternal' => 'http://craft-instantanalytics-ga4-'.$versionName.'-buildchain-dev:'.$devPort, |
|
| 50 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
| 51 | 51 | 'errorEntry' => 'src/js/app.ts', |
| 52 | 52 | 'useDevServer' => true, |
| 53 | 53 | ], |