diff --git a/popup_onload.js b/popup_onload.js
index 0a17e20..1b18b9f 100644
--- a/popup_onload.js
+++ b/popup_onload.js
@@ -10,14 +10,22 @@ Drupal.behaviors.initPopupOnLoad = {
     if (!$.isFunction($.colorbox)) {
       return;
     }
+    var popup_onload_settings = settings.popup_onload;
+    if ($.cookie(popup_onload_settings.cookieName) == undefined) {
+      $('body', context).once('popup_onload', function() {
+        setTimeout(function() {
+          $.colorbox(popup_onload_settings);
+        }, popup_onload_settings.delay);
 
-    $('body', context).once('popup_onload', function() {
-      var popup_onload_settings = settings.popup_onload;
+        var date = new Date();
+        date.setTime(date.getTime() + popup_onload_settings.cookieLifetime * 1000);
 
-      setTimeout(function() {
-        $.colorbox(popup_onload_settings);
-      }, popup_onload_settings.delay);
-    });
+        $.cookie(popup_onload_settings.cookieName, date.getTime(), {
+            expires: date,
+            path: '/',
+        });
+      });
+    }
   }
 }
 
diff --git a/popup_onload.module b/popup_onload.module
index ae493a3..b465553 100644
--- a/popup_onload.module
+++ b/popup_onload.module
@@ -61,15 +61,6 @@ function popup_onload_choose_popup() {
 }
 
 /**
- * Implements hook_popup_onload_check_display_conditions().
- *
- * @see popup_onload_check_display_conditions()
- */
-function popup_onload_popup_onload_check_display_conditions($popup_onload) {
-  return !popup_onload_check_time_cookie();
-}
-
-/**
  * Determine whether the popup is allowed to display.
  *
  * @param object $popup_onload
@@ -124,7 +115,6 @@ function popup_onload_init() {
           if (popup_onload_check_display_conditions($popup_onload)) {
             $popup_settings = popup_onload_prepare_popup($popup_onload);
             popup_onload_add_popup($popup_settings);
-            popup_onload_save_time_cookie($popup_onload);
           }
         }
       }
@@ -174,18 +164,26 @@ function popup_onload_sort_methods() {
  * @param object $popup_onload
  *   Fully populated popup_onload entity.
  *
+ * @param object $settings
+ *   An array of javascript settings already set.
+ *
  * @return array
  *   Popup javascript settings
  */
-function popup_onload_prepare_popup($popup_onload) {
+function popup_onload_prepare_popup($popup_onload, $settings = array()) {
   $popup_markup = entity_view('popup_onload', array($popup_onload->popup_id => $popup_onload), 'full', NULL, TRUE);
-  $popup_settings = array(
+
+  // Merge default settings with provided ones, giving preference to the ones
+  // provided in the argument
+  $popup_settings = $settings + array(
     'html' => drupal_render($popup_markup['popup_onload']),
     'delay' => variable_get(POPUP_ONLOAD_VAR_DISPLAY_DELAY, POPUP_ONLOAD_DEFAULT_DELAY),
     'fixed' => (bool) $popup_onload->fixed_position,
     'popup_id' => $popup_onload->popup_id,
     'className' => 'popup_onload',
     'close' => '',
+    'cookieName' => variable_get(POPUP_ONLOAD_VAR_COOKIE_NAME, POPUP_ONLOAD_DEFAULT_COOKIE_NAME),
+    'cookieLifetime' => variable_get(POPUP_ONLOAD_VAR_COOKIE_LIFETIME, POPUP_ONLOAD_DEFAULT_COOKIE_LIFETIME),
   );
 
   if ($popup_onload->width) {
@@ -202,27 +200,6 @@ function popup_onload_prepare_popup($popup_onload) {
 }
 
 /**
- * Check if popup_onload cookie is set.
- */
-function popup_onload_check_time_cookie($popup_onload = NULL) {
-  $cookie_name = variable_get(POPUP_ONLOAD_VAR_COOKIE_NAME, POPUP_ONLOAD_DEFAULT_COOKIE_NAME);
-  return isset($_COOKIE[$cookie_name]);
-}
-
-/**
- * Save popup display time into the cookie.
- */
-function popup_onload_save_time_cookie() {
-  $cookie_name = variable_get(POPUP_ONLOAD_VAR_COOKIE_NAME, POPUP_ONLOAD_DEFAULT_COOKIE_NAME);
-  $expire_seconds = variable_get(POPUP_ONLOAD_VAR_COOKIE_LIFETIME, POPUP_ONLOAD_DEFAULT_COOKIE_LIFETIME);
-  $cur_time = time();
-  setcookie($cookie_name,
-      $cur_time,
-      $cur_time + $expire_seconds,
-      '/');
-}
-
-/**
  * Implements hook_libraries_info().
  *
  * Code has been taken from Colorbox module.
@@ -274,6 +251,7 @@ function popup_onload_add_popup($popup_settings) {
 
   // Add popup_onload javascripts.
   drupal_add_js(array('popup_onload' => $popup_settings), 'setting');
+  drupal_add_library('system', 'jquery.cookie');
   drupal_add_js($module_path . '/popup_onload.js');
 
   // Add some basic colorbox styling.
diff --git a/popup_onload.rules.inc b/popup_onload.rules.inc
index a403c9e..1221af2 100644
--- a/popup_onload.rules.inc
+++ b/popup_onload.rules.inc
@@ -25,24 +25,6 @@ function popup_onload_rules_event_info() {
 }
 
 /**
- * Implements hook_rules_condition_info().
- */
-function popup_onload_rules_condition_info() {
-  return array(
-    'popup_onload_condition_check_cookie' => array(
-      'label' => t('Popup-on-load cookie is not set'),
-      'parameter' => array(
-        'popup_onload' => array(
-          'type' => 'popup_onload',
-          'label' => t('Popup-on-load entity'),
-        ),
-      ),
-      'group' => t('Popup On Load'),
-    ),
-  );
-}
-
-/**
  * Implements hook_rules_action_info().
  */
 function popup_onload_rules_action_info() {
@@ -54,6 +36,20 @@ function popup_onload_rules_action_info() {
           'type' => 'popup_onload',
           'label' => t('Popup On Load'),
         ),
+        'cookie_name' => array(
+          'type' => 'text',
+          'label' => t('Cookie name'),
+          'description' => t('Override this only if your server configuration filters out cookies with certain pattern.'),
+          'default value' => POPUP_ONLOAD_DEFAULT_COOKIE_NAME,
+          'restriction' => 'input',
+        ),
+        'cookie_lifetime' => array(
+          'type' => 'text',
+          'label' => t('Cookie lifetime'),
+          'description' => t('How many seconds popups will not be displayed to the user after the first display.'),
+          'default value' =>POPUP_ONLOAD_DEFAULT_COOKIE_LIFETIME,
+          'restriction' => 'input',
+      ),
       ),
       'group' => t('Popup On Load'),
     ),
@@ -61,19 +57,15 @@ function popup_onload_rules_action_info() {
 }
 
 /**
- * Condition to check if popup cookie is set.
- */
-function popup_onload_condition_check_cookie($popup_onload, $context = array()) {
-  return !popup_onload_check_time_cookie($popup_onload, $context = array());
-}
-
-/**
  * Action to display a popup.
  */
-function popup_onload_action_display_popup($popup_onload, $context = array()) {
-  $popup_settings = popup_onload_prepare_popup($popup_onload);
+function popup_onload_action_display_popup($popup_onload, $cookie_name, $cookie_lifetime, $context = array()) {
+  $settings = array(
+    'cookieName' => $cookie_name,
+    'cookieLifetime' => $cookie_lifetime,
+  );
+  $popup_settings = popup_onload_prepare_popup($popup_onload, $settings);
   popup_onload_add_popup($popup_settings);
-  popup_onload_save_time_cookie($popup_onload);
 }
 
 /**
diff --git a/popup_onload_display/popup_onload_display.rules_defaults.inc b/popup_onload_display/popup_onload_display.rules_defaults.inc
index d05e57a..0e5c2b1 100644
--- a/popup_onload_display/popup_onload_display.rules_defaults.inc
+++ b/popup_onload_display/popup_onload_display.rules_defaults.inc
@@ -14,8 +14,7 @@ function popup_onload_display_default_rules_configuration() {
       "PLUGIN" : "reaction rule",
       "REQUIRES" : [ "popup_onload" ],
       "ON" : [ "popup_onload_event_choose_popup" ],
-      "IF" : [ { "popup_onload_condition_check_cookie" : { "popup_onload" : [ "popup_onload" ] } } ],
-      "DO" : [ { "popup_onload_action_display_popup" : { "popup_onload" : [ "popup_onload" ] } } ]
+      "DO" : [ { "popup_onload_action_display_popup" : { "popup_onload" : [ "popup_onload" ], "cookie_name" : "' . POPUP_ONLOAD_DEFAULT_COOKIE_NAME . '", "cookie_lifetime" : ' . POPUP_ONLOAD_DEFAULT_COOKIE_LIFETIME . ' } } ]
     }
   }');
   return $items;
