PHP code example of visitor-analytics / 3as-sdk
1. Go to this page and download the library: Download visitor-analytics/3as-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
visitor-analytics / 3as-sdk example snippets
$visa = new VisitorAnalytics([
'intp' => [
'id' => {INTP_ID},
'privateKey' => {INTP_RS256_PRIVATE_KEY}
],
'env' => 'stage'
]);
$visa->customers->create([
'intpCustomerId' => {INTP_CUSTOMER_ID},
'email' => {INTP_CUSTOMER_EMAIL},
'website' => [
'intpWebsiteId' => {INTP_WEBSITE_ID},
'domain' => {INTP_WEBSITE_DOMAIN_URI},
'packageId' => {PACKAGE_UUID},
'billingDate' => {ISO_DATE_STRING} (optional, defaults to current time)
]
]);
$visa->customers->list();
$visa->customers->getByIntpCustomerId({INTP_CUSTOMER_ID});
$visa->customer({INTP_CUSTOMER_ID})->listWebsites();
$visa->customer({INTP_CUSTOMER_ID})->delete();
$visa->customer({INTP_CUSTOMER_ID})->generateIFrameDashboardUrl({INTP_WEBSITE_ID});
$visa->packages->list();
$visa->packages->getById({PACKAGE_UUID});
$visa->packages->create([
'name' => {PACKAGE_NAME},
'touchpoints' => {TOUCHPOINT_LIMIT},
'price' => {FLOAT},
'currency' => {CURRENCY_CODE}, // ex: EUR, USD, RON
'period' => {PERIOD}, // ex: monthly, yearly
]);
$visa->package({PACKAGE_UUID})->update([
'name' => {UPDATED_PACKAGE_NAME}
]);
$visa->websites->list();
$visa->websites->getByIntpWebsiteId({INTP_WEBSITE_ID});
$visa->websites->create([
'intpWebsiteId' => {INTP_WEBSITE_ID},
'intpCustomerId' => {INTP_CUSTOMER_ID},
'domain' => {INTP_WEBSITE_DOMAIN},
'packageId' => {PACKAGE_UUID},
'billingDate' => {ISO_DATE_STRING} (optional, defaults to current time)
]);
$visa->website({INTP_WEBSITE_ID})->delete());
$visa->subscriptions->upgrade([
"intpWebsiteId" => {INTP_WEBSITE_ID},
"packageId" => {PACKAGE_UUID},
"trial" => {true|false},
"proRate" => {true|false}
])
$visa->subscriptions->downgrade([
"intpWebsiteId" => {INTP_WEBSITE_ID},
"packageId" => {PACKAGE_UUID}
])
$visa->subscriptions->cancel([
"intpWebsiteId" => {INTP_WEBSITE_ID},
])
$visa->subscriptions->resume([
"intpWebsiteId" => {INTP_WEBSITE_ID},
])
$visa->subscriptions->deactivate([
"intpWebsiteId" => {INTP_WEBSITE_ID},
])
$visa->auth->generateINTPAccessToken();
$visa->auth->generateINTPcAccessToken({INTP_CUSTOMER_ID});
$visa->customers->list(['page' => 0, 'pageSize' => 5])