how to redirect page for anonymous users after number of times?
I don't think there are any contrib modules which can provide this functionality. This is not an ideal way but you can do it like this, I think:


Create a table (id, host_name, hash_code, visit_count)
Whenever you opens your site you will check for host_name, hash_code, and visit_count (if user is anonym)...


Example:

/**
 * 1 - I named the function as 'test' but this function must be called 
 * at page load, that's why you need find where to call it. may be 
 * TEMPLATE_preprocess_page() or HOOK_init()...
 * 2 - I can't say that here is everything is correct. Correct it if 
 * something is wrong.. because I didn't test it...
 */
function test() {

  if(user_is_anonymous()) {
    $host_name = ip_address();
    $hash_code = genCode(35);
    $query = db_select('MY_tABLE', 'mt')
      -&gt;fields('mt')
      -&gt;condition('host_name', $host_name, '=')
      -&gt;range(0,1)
      -&gt;orderBy('id', 'DESC')
      -&gt;execute()
      -&gt;fetchAssoc();

    if(empty($query)/* This user is the first time came to your site */) {
      $record = array(
        'host_name' =&gt; $host_name,
        'hash_code' =&gt; $hash_code,
        'visit_count' =&gt; 1,
      );
      drupal_write_record('MY_TABLE', $record);
    }
    /* This means that the user is anonymous but not a new user */
    else {
      if(isset($_COOKIE['anonym_code']) &amp;&amp; $_COOKIE['anonym_code'] == $query['hash_code']) {
        if($query['visit_count'] &gt; 4) {
          drupal_goto('user/register');
        }
      }
      else {
        setrawcookie('anonym_code', rawurlencode($hash_code), 0, '/');
        $visit_count = $query['visit_count'];
        $new_record = array(
          'host_name' =&gt; $host_name,
          'hash_code' =&gt; $hash_code,
          'visit_count' =&gt; $visit_count + 1,
        );
        drupal_write_record('MY_TABLE', $new_record);
      }
    }
  }
}

// Helper function
function genCode($length) {
  $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
  $string = '';
  for ($i = 0; $i &lt; $length; $i++) {
    $string .= $characters[mt_rand(0, strlen($characters) - 1)];
  }
  return $string;
}


I am sure that there are tons of bugs in that function;) I didn't test it... Also You need to implement hook_user_login() to delete a record from MY_TABLE right after the user registers and logs in.

P/S: Use this approach if you don't care about performance...