Whenever a subscriber clicks a link in a campaign Mailster sets a cookie on your domain to identify the user at a later point. This is required as often the subscriber doesn’t have an account on your site or is not logged in.

What exactly does the cookie do?

The cookie stores the hash of the subscriber which is a random string generated during the creation of the entry of the subscriber in the database.

What is the name of the cookie as shown in the browser.

The name of the cookie is “mailster” and is stored in the path defined by COOKIEPATH and assigned to the domain stored in COOKIE_DOMAIN.

At what time does the cookie expire?

By default the cookie expires one hour after the last click within a campaign. You can however use a filter to extend this time or disable the cookie completely:

add_filter( 'mailster_cookie_time', function( $timeout ){

     return MONTH_IN_SECONDS;

});

How is the cookie generated?

The cookie is created with PHP’s setcookie method. There’s no JavaScript used at any point.

setcookie( 'mailster', $hash, time() + $cookietime, COOKIEPATH, COOKIE_DOMAIN );

Where is the cookie used?

If either mailster_get_current_user() or mailster_get_current_user_id() is used Mailster first checks if this cookie is set.

Tagged: