diff --git a/src/Event/GoogleAnalyticsConfigEvent.php b/src/Event/GoogleAnalyticsConfigEvent.php
index 03be0c2..7051b70 100644
--- a/src/Event/GoogleAnalyticsConfigEvent.php
+++ b/src/Event/GoogleAnalyticsConfigEvent.php
@@ -2,9 +2,9 @@
 
 namespace Drupal\google_analytics\Event;
 
+use Symfony\Contracts\EventDispatcher\Event;
 use Drupal\google_analytics\GaAccount;
 use Drupal\google_analytics\Helpers\GoogleAnalyticsAccounts;
-use Symfony\Component\EventDispatcher\Event;
 use Drupal\google_analytics\GaJavascriptObject;
 
 /**
diff --git a/src/Event/GoogleAnalyticsEventsEvent.php b/src/Event/GoogleAnalyticsEventsEvent.php
index 5de4e73..2412391 100644
--- a/src/Event/GoogleAnalyticsEventsEvent.php
+++ b/src/Event/GoogleAnalyticsEventsEvent.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\google_analytics\Event;
 
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
 use Drupal\google_analytics\GaJavascriptObject;
 
 /**
diff --git a/src/Event/PagePathEvent.php b/src/Event/PagePathEvent.php
index ee1ac15..ff43bcc 100644
--- a/src/Event/PagePathEvent.php
+++ b/src/Event/PagePathEvent.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\google_analytics\Event;
 
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
 
 /**
  * Event that is fired when a user logs in.
diff --git a/src/JavascriptLocalCache.php b/src/JavascriptLocalCache.php
index 0d72efe..0f4ad15 100644
--- a/src/JavascriptLocalCache.php
+++ b/src/JavascriptLocalCache.php
@@ -117,7 +117,7 @@ class JavascriptLocalCache {
     }
     // Return the local JS file path.
     $query_string = '?' . (\Drupal::state()->get('system.css_js_query_string') ?: '0');
-    return file_url_transform_relative(file_create_url($file_destination)) . $query_string;
+    return \Drupal::service('file_url_generator')->generateString($file_destination) . $query_string;
   }
 
   /**
diff --git a/tests/src/Functional/GoogleAnalyticsCustomDimensionsAndMetricsTest.php b/tests/src/Functional/GoogleAnalyticsCustomDimensionsAndMetricsTest.php
index 3625a2d..0659535 100644
--- a/tests/src/Functional/GoogleAnalyticsCustomDimensionsAndMetricsTest.php
+++ b/tests/src/Functional/GoogleAnalyticsCustomDimensionsAndMetricsTest.php
@@ -41,7 +41,7 @@ class GoogleAnalyticsCustomDimensionsAndMetricsTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Functional/GoogleAnalyticsCustomUrls.php b/tests/src/Functional/GoogleAnalyticsCustomUrls.php
index 9d2d3ec..448d7dc 100644
--- a/tests/src/Functional/GoogleAnalyticsCustomUrls.php
+++ b/tests/src/Functional/GoogleAnalyticsCustomUrls.php
@@ -36,7 +36,7 @@ class GoogleAnalyticsCustomUrls extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Functional/GoogleAnalyticsRolesTest.php b/tests/src/Functional/GoogleAnalyticsRolesTest.php
index 803375f..741e585 100644
--- a/tests/src/Functional/GoogleAnalyticsRolesTest.php
+++ b/tests/src/Functional/GoogleAnalyticsRolesTest.php
@@ -36,7 +36,7 @@ class GoogleAnalyticsRolesTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Functional/GoogleAnalyticsSearchTest.php b/tests/src/Functional/GoogleAnalyticsSearchTest.php
index 9d80cfb..efda419 100644
--- a/tests/src/Functional/GoogleAnalyticsSearchTest.php
+++ b/tests/src/Functional/GoogleAnalyticsSearchTest.php
@@ -40,7 +40,7 @@ class GoogleAnalyticsSearchTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
diff --git a/tests/src/Functional/GoogleAnalyticsStatusMessagesTest.php b/tests/src/Functional/GoogleAnalyticsStatusMessagesTest.php
index c009037..aa9b358 100644
--- a/tests/src/Functional/GoogleAnalyticsStatusMessagesTest.php
+++ b/tests/src/Functional/GoogleAnalyticsStatusMessagesTest.php
@@ -38,7 +38,7 @@ class GoogleAnalyticsStatusMessagesTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Functional/GoogleAnalyticsUninstallTest.php b/tests/src/Functional/GoogleAnalyticsUninstallTest.php
index 0e25299..8b9b00d 100644
--- a/tests/src/Functional/GoogleAnalyticsUninstallTest.php
+++ b/tests/src/Functional/GoogleAnalyticsUninstallTest.php
@@ -38,7 +38,7 @@ class GoogleAnalyticsUninstallTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Functional/GoogleAnalyticsUserFieldsTest.php b/tests/src/Functional/GoogleAnalyticsUserFieldsTest.php
index 2c14661..626a439 100644
--- a/tests/src/Functional/GoogleAnalyticsUserFieldsTest.php
+++ b/tests/src/Functional/GoogleAnalyticsUserFieldsTest.php
@@ -38,7 +38,7 @@ class GoogleAnalyticsUserFieldsTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php b/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php
index 5765257..504401f 100644
--- a/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php
+++ b/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php
@@ -36,7 +36,7 @@ class GoogleAnalyticsFormValidationTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $permissions = [
diff --git a/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php b/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php
index 57a835d..e8c2e0e 100644
--- a/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php
+++ b/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php
@@ -37,7 +37,7 @@ class GoogleAnalyticsAdminSettingsFormTest extends KernelTestBase {
    *
    * @covers ::__construct
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installConfig(static::$modules);
