How to connect your website to your Brivacia installation
Replace:
- INSTALL_URL_BRIVACIA with your Brivacia installation URL
- SITE_CODE_X with a key from BRIVACIA_SITES in
/includes/config.php - PAGE_IDENTIFIER with a unique page ID
- PAGE_TITLE with the current page title
- TRACKED_WEBSITE_LANGUAGE for multilingual websites
Examples:
- WordPress: post ID / post title
- Laravel: route name / page title
- Static site: page slug / page title
The lang parameter is optional but recommended for multilingual websites.
JavaScript is recommended because it automatically sends the current URL and referrer. A noscript fallback is included for browsers with JavaScript disabled.
Generic example
<script>
(new Image()).src =
'https://INSTALL_URL_BRIVACIA/api/pixel.php?site=SITE_CODE_X' +
'&page=' + encodeURIComponent('PAGE_IDENTIFIER') +
'&lang=' + encodeURIComponent('TRACKED_WEBSITE_LANGUAGE') +
'&title=' + encodeURIComponent('PAGE_TITLE') +
'&url=' + encodeURIComponent(location.pathname) +
'&ref=' + encodeURIComponent(document.referrer || '');
</script>
<noscript>
<img src="https://INSTALL_URL_BRIVACIA/api/pixel.php?site=SITE_CODE_X&page=PAGE_IDENTIFIER&lang=TRACKED_WEBSITE_LANGUAGE&title=PAGE_TITLE&url=/" alt="" height="1" width="1">
</noscript>
Multilingual websites
For multilingual websites, send the current website language using the lang parameter.
Examples:
fr
en
es
ko
en-US
Brivacia stores this value as-is and can use it to distinguish pages translated into multiple languages.
PHP example
Replace $pageId, $pageTitle and your language variable with variables from your CMS, framework or application.
<script>
(new Image()).src =
'https://INSTALL_URL_BRIVACIA/api/pixel.php?site=SITE_CODE_X' +
'&page=<?= urlencode($pageId) ?>' +
'&lang=<?= urlencode($currentLanguage ?? '') ?>' +
'&title=<?= urlencode($pageTitle ?? '') ?>' +
'&url=' + encodeURIComponent(location.pathname) +
'&ref=' + encodeURIComponent(document.referrer || '');
</script>
<noscript>
<img src="https://INSTALL_URL_BRIVACIA/api/pixel.php?site=SITE_CODE_X&page=<?= urlencode($pageId) ?>&lang=<?= urlencode($currentLanguage ?? '') ?>&title=<?= urlencode($pageTitle ?? '') ?>&url=<?= urlencode($_SERVER['REQUEST_URI'] ?? '/') ?>" alt="" height="1" width="1">
</noscript>
Do you find this project useful? You can support its development using the buttons in the page footer.
breat.fr