If there is an unused field in the user profile, you could put a snippet in your template that checks that and redirects the user to the "subscribe" page (with $modx->sendRedirect() ) if at the limit and updates the value if not.
If there’s no unused field, you could do the same thing, but with an "extended" field in the user profile.
If you wanted to use the fax field, for example, the snippet would look something like this (untested):
<?php
$limit = 5;
$idOfLoginPage = 12; //set this to the ID of the Login page
$idOfSubscribePage = 23 // set this to the ID of the Subscribe page
/* redirect users who are not logged in */
if (!$modx->user->hasSessionContext('web')) {
$modx->sendRedirect($modx->makeUrl($idOfLoginPage));
}
$profile = $modx->user->getOne('Profile');
/* get the user's page views */
$count = (int) $profile->get('fax');
if ($count >= $limit) {
/* send user to subscribe page */
$modx->sendRedirect($modx->makeUrl($idOfSubscribePage));
} else {
$count++;
$profile->set('fax', $count);
}
/* update the page view value */
$profile->save();
return '';
Note that if you let the users update their profile, they’d be able to reset the page view count, though it would be inconvenient to do it every 5 page views.