Downloaden en instellen
Download variablepilot.php en vereist het in uw toepassing. De PHP SDK ondersteunt PHP 7.0 en later. Configureer uw werkelijke projectsleutel, omgeving, eindpunt, stabiele bezoeker ID, huidige URL, server credential en analytics toestemming.
Cliëntstructuur
php
<?php
require_once __DIR__ . '/varypilot.php';
$ab = new ABPlatform\Client(array(
'projectKey' => $publicProjectKey,
'environment' => $environmentName,
'endpoint' => 'https://varypilot-edge-api.silva-pires-ricardo86.workers.dev',
'serverKey' => getenv('VARYPILOT_SERVER_KEY'),
'visitorId' => $stableVisitorId,
'url' => $currentUrl,
'cacheDir' => $privateWritableCacheDirectory,
'consent' => $analyticsConsentGranted
));
$ab->init();
$variant = $ab->getVariant($experimentKey, $controlVariantKey);
// Render first, then record exposure.
$ab->trackExposure($experimentKey, $variant);
$ab->flush();Cache en levering
Gebruik een beschrijfbare, private cache directory. Houd de server credential buiten openbare bestanden en bronbeheer. Controleer gedrag voor netwerkfouten en niet-beschikbare configuratie voordat u naar de productie gaat.