First, create two versions of your site on your hosting service: one with ads on relevant pages and one without ads.
When a user visits the ad-enabled site, decrypt their __tac cookie using the Piano PHP SDK. Download the library here.
Do the following:
-
Read the
__taccookie value. -
URL-decode the value and remove the
{jax}prefix. -
Decrypt it using the private key from the Piano Dashboard.
-
For each resource the visitor can access, you receive these values in a JSON string.
ACCESS_ID = “id”;
BUILD_TIME = “bt”;
RID = “rid”;
UID = “uid”;
EX = “ex”;
EARLY_EX = “eex”;
CREATED_TIME = “ct”;
More information on checking access is available here.
Based on the returned active access, your server can display the ad-free or ad-lite version. This requires development work on your side.