diff --git a/googleanalytics.module b/googleanalytics.module
index 9efae87..0af9ca7 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -175,7 +175,7 @@ function googleanalytics_page_alter(&$page) {
     }
 
     // Add any custom code snippets if specified.
-    $codesnippet_before = variable_get('googleanalytics_codesnippet_before', '');
+    $codesnippet_before = preg_replace('/\r\n|\n/', '', (variable_get('googleanalytics_codesnippet_before', '')));
     $codesnippet_after = variable_get('googleanalytics_codesnippet_after', '');
 
     // Add custom variables.
