diff --git a/eu_cookie_compliance.admin.inc b/eu_cookie_compliance.admin.inc
index 04abe05..c7b93af 100755
--- a/eu_cookie_compliance.admin.inc
+++ b/eu_cookie_compliance.admin.inc
@@ -27,11 +27,11 @@ function eu_cookie_compliance_admin_form($form_state) {
     '#default_value' => isset($popup_settings['popup_enabled']) ? $popup_settings['popup_enabled'] : 0,
   );
 
-  $form['eu_cookie_compliance_' . $ln]['popup_clicking_confirmation'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Consent by clicking'),
-    '#default_value' => isset($popup_settings['popup_clicking_confirmation']) ? $popup_settings['popup_clicking_confirmation'] : 1,
-    '#description' => t('By default by clicking any link on the website the visitor accepts the cookie policy. Uncheck this box if you do not require this functionality. You may want to edit the pop-up message below accordingly.'),
+  $form['eu_cookie_compliance_' . $ln]['popup_clicking_confirmation'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Consent by clicking'),
+    '#default_value' => isset($popup_settings['popup_clicking_confirmation']) ? $popup_settings['popup_clicking_confirmation'] : 1,
+    '#description' => t('By default by clicking any link on the website the visitor accepts the cookie policy. Uncheck this box if you do not require this functionality. You may want to edit the pop-up message below accordingly.'),
   );
 
   if (module_exists('geoip')){
@@ -138,6 +138,13 @@ function eu_cookie_compliance_admin_form($form_state) {
     '#description' => t('Change the text color of the popup. Provide HEX value without the #'),
   );
 
+  $form['eu_cookie_compliance_' . $ln]['onaccept'] = array(
+    '#type' => 'textarea',
+    '#title' => t('On Cookie Accept'),
+    '#default_value' => isset($popup_settings['onaccept']) ? $popup_settings['onaccept'] : '',
+    '#description' => t('JavaScript code to be executed when a visitor gives consent for the site to use cookies. Example use can be to trigger analytics code to record the initial page visit.'),
+  );
+
   return system_settings_form($form);
 }
 
diff --git a/eu_cookie_compliance.module b/eu_cookie_compliance.module
index 5d6b96a..b78d8cc 100755
--- a/eu_cookie_compliance.module
+++ b/eu_cookie_compliance.module
@@ -53,11 +53,13 @@ function eu_cookie_compliance_init() {
     $popup_text_agreed = str_replace(array("\r", "\n"), '', $popup_settings['popup_agreed']['value']);
     $html_info = theme('eu_cookie_compliance_popup_info', array('message' => check_markup($popup_text_info, $popup_settings['popup_info']['format'], FALSE)));
     $html_agreed = theme('eu_cookie_compliance_popup_agreed', array('message' => check_markup($popup_text_agreed, $popup_settings['popup_agreed']['format'], FALSE)));
-    $clicking_confirmation = (isset($popup_settings['popup_clicking_confirmation']))? $popup_settings['popup_clicking_confirmation'] : TRUE ;
+    $clicking_confirmation = (isset($popup_settings['popup_clicking_confirmation']))? $popup_settings['popup_clicking_confirmation'] : TRUE;
+    $onaccept = (isset($popup_settings['onaccept'])) ? $popup_settings['onaccept'] : '';
     $variables = array(
       'popup_enabled' => $popup_settings['popup_enabled'],
       'popup_agreed_enabled' => $popup_settings['popup_agreed_enabled'],
       'popup_hide_agreed' => isset($popup_settings['popup_hide_agreed']) ? $popup_settings['popup_hide_agreed'] : FALSE,
+      'onaccept' => $onaccept,
       'popup_clicking_confirmation' => $clicking_confirmation,
       'popup_html_info' => empty($html_info) ? FALSE : $html_info,
       'popup_html_agreed' => empty($html_agreed) ? FALSE : $html_agreed,
diff --git a/js/eu_cookie_compliance.js b/js/eu_cookie_compliance.js
index 242d9f1..3e4af69 100755
--- a/js/eu_cookie_compliance.js
+++ b/js/eu_cookie_compliance.js
@@ -83,12 +83,14 @@
   Drupal.eu_cookie_compliance.attachEvents = function() {
 	var clicking_confirms = Drupal.settings.eu_cookie_compliance.popup_clicking_confirmation;
     var agreed_enabled = Drupal.settings.eu_cookie_compliance.popup_agreed_enabled;
+    var onaccept_code = Drupal.settings.eu_cookie_compliance.onaccept;
     $('.find-more-button').click(function(){
       window.open(Drupal.settings.eu_cookie_compliance.popup_link);
     });
     $('.agree-button').click(function(){
       var next_status = 1;
       if(!agreed_enabled) {
+        Drupal.eu_cookie_compliance.onAcccept(onaccept_code);
         Drupal.eu_cookie_compliance.setStatus(1);
         next_status = 2;
       }
@@ -103,7 +105,7 @@
   }
 
   Drupal.eu_cookie_compliance.getCurrentStatus = function() {
-    var search = 'cookie-agreed-'+Drupal.settings.eu_cookie_compliance.popup_language+'=';
+    var search = 'cookie-agreed-' + Drupal.settings.eu_cookie_compliance.popup_language + '=';
     var offset = document.cookie.indexOf(search);
     if (offset < 0) {
       return 0;
@@ -147,7 +149,7 @@
   Drupal.eu_cookie_compliance.setStatus = function(status) {
     var date = new Date();
     date.setDate(date.getDate() + 100);
-    document.cookie = "cookie-agreed-"+Drupal.settings.eu_cookie_compliance.popup_language + "="+status+";expires=" + date.toUTCString() + ";path=" + Drupal.settings.basePath;
+    document.cookie = "cookie-agreed-" + Drupal.settings.eu_cookie_compliance.popup_language + "=" + status + ";expires=" + date.toUTCString() + ";path=" + Drupal.settings.basePath;
   }
 
   Drupal.eu_cookie_compliance.hasAgreed = function() {
@@ -166,5 +168,9 @@
       }
     return (cookieEnabled);
   }
-  
-})(jQuery);
\ No newline at end of file
+
+  Drupal.eu_cookie_compliance.onAcccept = function(code) {
+    eval(code);
+  }
+
+})(jQuery);
