Server-render sdk.js and reaction-video for ReactionSDK overlays (tap, poll, rating, slider, and CTA). Works with plain PHP, Laravel Blade, Symfony Twig (same markup), etc.
ReactifySDK threads / in-page recorder: ReactifySDK PHP installation. WordPress plugin path: WordPress guide.
1) Helper (optional)
reaction_sdk_embed.php
<?php
/** reaction_sdk_embed.php — include once in your layout */
function reaction_sdk_script_url(): string {
return 'https://reactify-cdn.s3.us-east-2.amazonaws.com/sdk.js?v=2.0.8';
}
function reaction_sdk_print_boot(?string $apiKey = null, ?string $accountId = null): void {
$src = htmlspecialchars(reaction_sdk_script_url(), ENT_QUOTES, 'UTF-8');
echo '<script src="' . $src . '"></script>' . "\n";
if ($apiKey === null || $apiKey === '') {
return;
}
$payload = [
'apiKey' => $apiKey,
'accountId' => $accountId,
'baseUrl' => 'https://api.reactionsaas.com',
'mode' => 'production',
'allowedOrigins' => [], // fill with your site origin(s)
];
$json = json_encode($payload, JSON_UNESCAPED_SLASHES);
echo '<script>window.Reactify&&Reactify.init(' . $json . ');</script>' . "\n";
}
function reaction_sdk_video(array $attrs): string {
$src = htmlspecialchars($attrs['src'] ?? 'https://yourcdn.com/video.mp4', ENT_QUOTES, 'UTF-8');
$overlays = htmlspecialchars($attrs['overlays'] ?? 'tap,poll,rating,slider', ENT_QUOTES, 'UTF-8');
$cta = htmlspecialchars($attrs['cta_text'] ?? 'Buy Now', ENT_QUOTES, 'UTF-8');
$poll = htmlspecialchars($attrs['poll_question'] ?? '', ENT_QUOTES, 'UTF-8');
$interaction = htmlspecialchars($attrs['interaction_type'] ?? 'tap', ENT_QUOTES, 'UTF-8');
$html = '<reaction-video src="' . $src . '" overlays="' . $overlays . '"';
$html .= ' cta-text="' . $cta . '" interaction-type="' . $interaction . '"';
if ($poll !== '') {
$html .= ' poll-question="' . $poll . '"';
}
$html .= '></reaction-video>';
return $html;
}2) Layout + embed
page.php
<?php
require_once __DIR__ . '/reaction_sdk_embed.php';
$apiKey = getenv('REACTION_API_KEY') ?: '';
$accountId = getenv('REACTION_ACCOUNT_ID') ?: '';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Product</title>
</head>
<body>
<?php reaction_sdk_print_boot($apiKey ?: null, $accountId ?: null); ?>
<main>
<?php
echo reaction_sdk_video([
'src' => 'https://yourcdn.com/video.mp4',
'overlays' => 'tap,poll,rating,slider',
'poll_question' => 'Which style do you prefer?',
'cta_text' => 'Buy Now',
'interaction_type' => 'tap',
]);
?>
</main>
</body>
</html>Run in Playground
<reaction-video src="video.mp4" overlays="tap,poll,rating,slider,cta" cta-text="Buy Now" interaction-type="poll"></reaction-video>Try this config in the Playground.
3) View analytics
Open the dashboard after production init with your API key.
Open DashboardTry it live
Preview overlay interactions on a sample video (same demo as the docs playground).
Rate:
ReactionSDK demo