breat.fr

How to connect your website to your Brivacia installation

Replace:

Examples:

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&amp;page=PAGE_IDENTIFIER&amp;lang=TRACKED_WEBSITE_LANGUAGE&amp;title=PAGE_TITLE&amp;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&amp;page=<?= urlencode($pageId) ?>&amp;lang=<?= urlencode($currentLanguage ?? '') ?>&amp;title=<?= urlencode($pageTitle ?? '') ?>&amp;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.