PHP
Add the tracker to PHP layouts and server-rendered applications.
Layout integration
Read the tracking ID from your application configuration and render it into the shared layout.
<script async src="<?= htmlspecialchars($analyticsUrl) ?>/analytica.js"></script>
<script>
window.analytica = window.analytica || [];
window.analytica.push(["init", {
projectId: "<?= htmlspecialchars($analyticsProjectId) ?>"
}]);
</script>Track conversions
Call track() from client-side PHP-rendered pages after key actions to feed Goals and Funnel event steps.
window.analytica.push(["track", "signup_completed"]);