diff --git a/usercentrics_cmp.module b/usercentrics_cmp.module
index 2e9d63b5c53967b0282b9c4688c62a869cdb1ff2..5b5d334a3b6bf9a343cbd04815547ef7add333a2 100644
--- a/usercentrics_cmp.module
+++ b/usercentrics_cmp.module
@@ -48,9 +48,6 @@ function usercentrics_cmp_page_attachments(array &$attachments) {
  * Alters the JavaScript tags to comply with the consent manager.
  */
 function usercentrics_cmp_page_attachments_alter(array &$attachments) {
-  $config = \Drupal::config('usercentrics_cmp.settings');
-  $additional_parameters = $config->get('additional_parameters');
-
   foreach ($attachments['#attached']['html_head'] as $index => $attachment) {
     if (isset($attachment[1]) && $attachment[1] === 'google_analytics_tracking_script') {
       $attachments['#attached']['html_head'][$index][0]['#attributes']['type'] = 'text/plain';
@@ -61,16 +58,20 @@ function usercentrics_cmp_page_attachments_alter(array &$attachments) {
       $attachments['#attached']['html_head'][$index][0]['#attributes']['data-usercentrics'] = 'Facebook Pixel';
     }
   }
+}
 
+/**
+ * Implements hook_page_bottom().
+ */
+function usercentrics_cmp_page_bottom(array &$page_top) {
+  $config = \Drupal::config('usercentrics_cmp.settings');
+  $additional_parameters = $config->get('additional_parameters');
   if (!empty($additional_parameters)) {
     // Additional_parameters (snippet)
-    $attachments['#attached']['html_head'][] = [
-      [
-        '#type' => 'html_tag',
-        '#tag' => 'script',
-        '#value' => "$additional_parameters",
-      ],
-      'usercentrics_cmp_additional_parameters',
+    $page_top['top_scripts_usercentrics_cmp'] = [
+      '#type' => 'html_tag',
+      '#tag' => 'script',
+      '#value' => "$additional_parameters",
     ];
   }
 }