diff --git a/google_tag.module b/google_tag.module
index dab8ea37caac87a7c4068fe6742dd4621cfaea78..a633e38581ee3a466ad24dd1199f0a36dcf9090b 100644
--- a/google_tag.module
+++ b/google_tag.module
@@ -61,21 +61,32 @@ function google_tag_page_top(array &$page) {
   $cacheable_metadata = new CacheableMetadata();
   $cacheable_metadata->addCacheTags($definition->getListCacheTags());
 
-  /** @var \Drupal\google_tag\Entity\TagContainer|null $config */
-  $config = \Drupal::service('google_tag.tag_container_resolver')->resolve();
-
-  if ($config === NULL || $config->getGtmId() === '') {
+  /** @var \Drupal\google_tag\Entity\TagContainer[]|null $config */
+  $configs = \Drupal::service('google_tag.tag_container_resolver')->resolve();
+  if (!$configs) {
     $cacheable_metadata->applyTo($page);
     return;
   }
 
-  $cacheable_metadata->addCacheableDependency($config);
+  $gtm_ids = [];
+  $container_gtm_id_map = [];
+
+  foreach ($configs as $config) {
+    $cacheable_metadata->addCacheableDependency($config);
+    $gtm_ids = array_merge($gtm_ids, $config->getGtmIds());
+
+    // Store a mapping of GTM ID -> Tag Container.
+    foreach ($config->getGtmIds() as $gtm_id) {
+      $container_gtm_id_map[$gtm_id] = $config;
+    }
+  }
+
   $cacheable_metadata->applyTo($page);
-  $gtm_ids = $config->getGtmIds();
 
   foreach ($gtm_ids as $gtm_id) {
-    $adv_settings = $config->getGtmSettings($gtm_id);
     if ($gtm_id !== '') {
+      $adv_settings = $container_gtm_id_map[$gtm_id]->getGtmSettings($gtm_id);
+
       $query_params = [
         'id' => $gtm_id,
       ];
@@ -102,43 +113,70 @@ function google_tag_page_attachments(array &$attachments) {
   $cacheable_metadata = CacheableMetadata::createFromRenderArray($attachments);
   $cacheable_metadata->addCacheTags($definition->getListCacheTags());
 
-  /** @var \Drupal\google_tag\Entity\TagContainer|null $config */
-  $config = \Drupal::service('google_tag.tag_container_resolver')->resolve();
+  /** @var \Drupal\google_tag\Entity\TagContainer[]|null $configs */
+  $configs = \Drupal::service('google_tag.tag_container_resolver')->resolve();
 
-  if ($config === NULL) {
+  if (!$configs) {
     $cacheable_metadata->applyTo($attachments);
     return;
   }
-  $cacheable_metadata->addCacheableDependency($config);
   $cacheable_metadata->applyTo($attachments);
+  $metrics_processor = \Drupal::service('google_tag.dimensions_metrics_processor');
+
+  $gtm_ids = [];
+  $default_id = NULL;
+  $additional_ids = [];
+  $additional_config_info = [];
+  $container_gtm_id_map = [];
+  $consent_mode = TRUE;
+
+  foreach ($configs as $config) {
+    $cacheable_metadata->addCacheableDependency($config);
+    $gtm_ids = array_merge($gtm_ids, $config->getGtmIds());
+    $default_id = $config->getDefaultTagId() ?? $default_id;
+
+    // Store a mapping of GTM ID -> Tag Container.
+    foreach ($config->getGtmIds() as $gtm_id) {
+      $container_gtm_id_map[$gtm_id] = $config;
+    }
+
+    $consent_mode = $config->getConsentMode();
+    $additional_ids = array_merge($additional_ids, $config->getAdditionalIds());
+    $additional_config_info = array_merge($additional_config_info, $metrics_processor->getValues($config));
+  }
 
   // @todo Put this data into their own respective methods?
   // GTM JS embed.
-  if ($config->getGtmIds() !== []) {
+  if ($gtm_ids !== []) {
     $attachments['#attached']['library'][] = 'google_tag/gtm';
-    $gtm = [
-      'tagIds' => $config->getGtmIds(),
-    ];
-    $settings = $config->getGtmSettings();
-    $gtm['settings'] = $settings;
-    if (isset($settings['include_classes']) && $settings['include_classes'] === TRUE) {
-      $gtm['settings']['allowlist_classes'] = explode(PHP_EOL, $settings['allowlist_classes']);
-      $gtm['settings']['blocklist_classes'] = explode(PHP_EOL, $settings['blocklist_classes']);
+    $gtm = ['tagIds' => $gtm_ids];
+
+    foreach ($gtm_ids as $gtm_id) {
+      if ($gtm_id !== '') {
+        $adv_settings = $container_gtm_id_map[$gtm_id]->getGtmSettings($gtm_id);
+        $gtm['settings'][$gtm_id] = $adv_settings;
+
+        if (isset($adv_settings['include_classes']) && $adv_settings['include_classes'] === TRUE) {
+          $gtm['settings'][$gtm_id]['allowlist_classes'] = explode(PHP_EOL, $adv_settings['allowlist_classes']);
+          $gtm['settings'][$gtm_id]['blocklist_classes'] = explode(PHP_EOL, $adv_settings['blocklist_classes']);
+        }
+      }
     }
+
     $attachments['#attached']['drupalSettings']['gtm'] = $gtm;
   }
 
   // ^ returns the config which is active and the main tag ID.
   // @todo if no config, only send events to datalayer.
-  if ($config->getDefaultTagId()) {
+  if ($default_id) {
     $attachments['#attached']['library'][] = 'google_tag/gtag';
     $attachments['#attached']['library'][] = 'google_tag/gtag.ajax';
     $attachments['#attached']['drupalSettings']['gtag'] = [
-      'tagId' => $config->getDefaultTagId(),
-      'otherIds' => $config->getAdditionalIds(),
-      'consentMode' => $config->getConsentMode(),
+      'tagId' => $default_id,
+      'otherIds' => $additional_ids,
+      'consentMode' => $consent_mode,
       'events' => [],
-      'additionalConfigInfo' => \Drupal::service('google_tag.dimensions_metrics_processor')->getValues($config),
+      'additionalConfigInfo' => $additional_config_info,
     ];
 
     $collector = \Drupal::getContainer()->get('google_tag.event_collector');
diff --git a/js/gtm.js b/js/gtm.js
index 7550f4a65ad5339f6a1ab8b12fe75bd6fc4e5a03..0e1749eca0c5168b157c6c9aee02e9f98099d21d 100644
--- a/js/gtm.js
+++ b/js/gtm.js
@@ -1,5 +1,5 @@
 (function (drupalSettings) {
-  const dl = drupalSettings.gtm ? drupalSettings.gtm.settings.data_layer : 'dataLayer';
+  const dl = drupalSettings.gtm && drupalSettings.gtm.settings.data_layer ? drupalSettings.gtm.settings.data_layer : 'dataLayer';
   window[dl] = window[dl] || [];
 
   if (!drupalSettings.gtm) {return;}
@@ -7,20 +7,22 @@
 
   window[dl].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
   const gtmSettings = config.settings;
-  if (gtmSettings.include_classes === true) {
-    window[dl].push({
-      'gtm.allowlist': gtmSettings.allowlist_classes ?? [],
-      'gtm.blocklist': gtmSettings.blocklist_classes ?? [],
-    });
-  }
+  let allowlist = [];
+  let blocklist = [];
 
-  let gtm_environment = '';
-  if (gtmSettings.include_environment === true) {
-    const gtm_auth = gtmSettings.environment_token ?? '';
-    const gtm_preview = gtmSettings.environment_id ?? '';
-    gtm_environment = `&gtm_auth=${gtm_auth}&gtm_preview=${gtm_preview}&gtm_cookies_win=x`;
-  }
   config.tagIds.forEach(function (tagId) {
+    if (gtmSettings.include_classes === true) {
+      allowlist = allowlist.concat(gtmSettings[tagId].allowlist_classes);
+      blocklist = blocklist.concat(gtmSettings[tagId].blocklist_classes);
+    }
+
+    let gtm_environment = '';
+    if (gtmSettings.include_environment === true) {
+      const gtm_auth = gtmSettings[tagId].environment_token ?? '';
+      const gtm_preview =  gtmSettings[tagId].environment_id ?? '';
+      gtm_environment = `&gtm_auth=${gtm_auth}&gtm_preview=${gtm_preview}&gtm_cookies_win=x`;
+    }
+  
     const script = document.createElement('script');
     script.async = true;
     const dLink = dl != 'dataLayer' ? `&l=${dl}` : '';
@@ -28,4 +30,12 @@
     script.type = 'text/javascript';
     document.getElementsByTagName('head')[0].appendChild(script);
   });
+
+    if (allowlist.length || blocklist.length) {
+      window[dl].push({
+        'gtm.allowlist': allowlist,
+        'gtm.blocklist': blocklist,
+      });
+    }
+
 })(drupalSettings);
diff --git a/src/EventCollector.php b/src/EventCollector.php
index 3cfdf40f3a8eeda130db0a4fd47a530dd699304e..b440f1d061fa5bdf48442e2b021ee96bb0164e6a 100644
--- a/src/EventCollector.php
+++ b/src/EventCollector.php
@@ -116,20 +116,26 @@ final class EventCollector implements EventCollectorInterface {
    * @throws \Drupal\Component\Plugin\Exception\PluginException
    */
   private function createEventInstance(string $name, array $contexts = []): ?GoogleTagEventInterface {
-    $config = $this->tagResolver->resolve();
-    if ($config === NULL || !$config->hasEvent($name)) {
+    $configs = $this->tagResolver->resolve();
+    if (!$configs) {
       return NULL;
     }
 
-    $event = $this->googleTagEventManager->createInstance(
-      $name,
-      $config->getEventConfiguration($name),
-    );
-    assert($event instanceof GoogleTagEventInterface);
-    foreach ($contexts as $id => $context) {
-      $event->setContextValue($id, $context);
+    foreach ($configs as $config) {
+      if (!$config->hasEvent($name)) {
+        continue;
+      }
+      $event = $this->googleTagEventManager->createInstance(
+        $name,
+        $config->getEventConfiguration($name),
+      );
+      assert($event instanceof GoogleTagEventInterface);
+      foreach ($contexts as $id => $context) {
+        $event->setContextValue($id, $context);
+      }
+      return $event;
     }
-    return $event;
+    return NULL;
   }
 
 }
diff --git a/src/TagContainerResolver.php b/src/TagContainerResolver.php
index 783852b86ae1c7a3e1774126c825a174b44bbaad..ec0acbd851eb06ecda3385c2cabc648e7c8282d7 100644
--- a/src/TagContainerResolver.php
+++ b/src/TagContainerResolver.php
@@ -81,13 +81,13 @@ final class TagContainerResolver {
   /**
    * Resolves google tag config based on request.
    *
-   * @return \Drupal\google_tag\Entity\TagContainer|null
+   * @return \Drupal\google_tag\Entity\TagContainer[]|null
    *   Google tag entity if resolved, otherwise null.
    *
    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
    */
-  public function resolve(): ?TagContainer {
+  public function resolve(): ?array {
     $request = $this->requestStack->getCurrentRequest();
     if ($request === NULL) {
       return NULL;
@@ -102,14 +102,16 @@ final class TagContainerResolver {
         ->execute();
       /** @var array<string, TagContainer> $configs */
       $configs = $storage->loadMultiple($config_ids);
+      $passed_configs = [];
       foreach ($configs as $config) {
         if (!$this->passesConditions($config)) {
           continue;
         }
-        $this->resolved[$request] = $config;
-        break;
+        $passed_configs[] = $config;
       }
+      $this->resolved->attach($request, $passed_configs);
     }
+
     return $this->resolved[$request] ?? NULL;
   }
 
diff --git a/tests/src/Kernel/PageAttachmentsHookTest.php b/tests/src/Kernel/PageAttachmentsHookTest.php
index 26299e73f75fd7f0e6312c4a3b706056d9fa270a..f4ee21d8a281cc74579102947fbf851356b2c3e3 100644
--- a/tests/src/Kernel/PageAttachmentsHookTest.php
+++ b/tests/src/Kernel/PageAttachmentsHookTest.php
@@ -172,9 +172,16 @@ final class PageAttachmentsHookTest extends GoogleTagTestCase {
     self::assertEquals([
       'tagIds' => ['GTM-XXXXXX', 'GTM-YYYYYY'],
       'settings' => [
-        'include_classes' => TRUE,
-        'allowlist_classes' => explode(PHP_EOL, $allowlist_classes),
-        'blocklist_classes' => explode(PHP_EOL, $blocklist_classes),
+        'GTM-XXXXXX' => [
+          'include_classes' => TRUE,
+          'allowlist_classes' => explode(PHP_EOL, $allowlist_classes),
+          'blocklist_classes' => explode(PHP_EOL, $blocklist_classes),
+        ],
+        'GTM-YYYYYY' => [
+          'include_classes' => TRUE,
+          'allowlist_classes' => explode(PHP_EOL, $allowlist_classes),
+          'blocklist_classes' => explode(PHP_EOL, $blocklist_classes),
+        ],
       ],
     ],
     $page['#attached']['drupalSettings']['gtm']);
diff --git a/tests/src/Kernel/TagContainerResolverTest.php b/tests/src/Kernel/TagContainerResolverTest.php
index 0c38579dd02baeeecf056ec52967ba3e42f886a1..940280d61f7411b78c8fb84637a14eabb4cc0e89 100644
--- a/tests/src/Kernel/TagContainerResolverTest.php
+++ b/tests/src/Kernel/TagContainerResolverTest.php
@@ -33,7 +33,7 @@ final class TagContainerResolverTest extends GoogleTagTestCase {
     $request1 = Request::create('/');
     $request2 = Request::create('/');
     $sut = $this->container->get('google_tag.tag_container_resolver');
-    self::assertNull($sut->resolve());
+    self::assertEmpty($sut->resolve());
 
     $config1 = TagContainer::create([
       'id' => 'foo',
@@ -47,8 +47,8 @@ final class TagContainerResolverTest extends GoogleTagTestCase {
     }
     $this->container->get('request_stack')->push($request1);
     $resolved = $sut->resolve();
-    self::assertNotNull($resolved);
-    self::assertEquals($config1->id(), $resolved->id());
+    self::assertNotEmpty($resolved);
+    self::assertEquals($config1->id(), $resolved[0]->id());
 
     $config2 = TagContainer::create([
       'id' => 'bar',
@@ -63,8 +63,8 @@ final class TagContainerResolverTest extends GoogleTagTestCase {
     }
     $this->container->get('request_stack')->push($request2);
     $resolved = $sut->resolve();
-    self::assertNotNull($resolved);
-    self::assertEquals($config2->id(), $resolved->id());
+    self::assertNotEmpty($resolved);
+    self::assertEquals($config2->id(), $resolved[0]->id());
   }
 
   /**
