Skip to content

Add Script To Your Website

After you add a website, install the Fluentos script on it. Only then can your campaigns show to visitors.

Open Settings at the bottom of the left menu, switch to the Websites tab, and click Install Script next to the website. The Install the Fluentos script dialog shows two scripts, the marketing script and the analytics script, each with its own Copy button.

  • A tag in Google Tag Manager: create the tags as the dialog describes (see Recommended setup in Google Tag Manager).
  • A script on the website: copy the scripts and paste them into your website’s header or footer.

Fluentos uses cookies that need the visitor’s consent under GDPR and ePrivacy rules. For the full list of Fluentos cookies and what they do, see Fluentos cookies (GDPR & ePrivacy guide).

Install Fluentos under the right consent categories:

  • Marketing consent: load the Fluentos marketing script after the visitor accepts Marketing consent. Campaigns need it to show, to check display rules (page views, sessions), and to show personalized content.

  • Analytics/Statistics consent: turn on analytics after the visitor accepts Analytics/Statistics consent. Fluentos can then count impressions correctly, report how sessions started, and report visitor types.

When the visitor accepts Analytics/Statistics consent, set this flag:

<!-- Fluentos Analytics -->
<script nonce="9hmDFLK2hKG2OzPwMMSZlw==">
window.fluentosAnalyticsConsent = true
</script>
<!-- End Fluentos Analytics -->

In a Single Page Application (SPA), the analytics consent script must run on every route change, not only when the app first loads.

An SPA changes pages without a full reload, so set the flag from the visitor’s current consent each time:

<!-- Fluentos Analytics -->
<script nonce="9hmDFLK2hKG2OzPwMMSZlw==">
window.fluentosAnalyticsConsent = `DYNAMIC_VALUE`
</script>
<!-- End Fluentos Analytics -->

Replace DYNAMIC_VALUE with:

  • true when the visitor has accepted Analytics/Statistics consent
  • false when the visitor has not accepted it, or has withdrawn it
Section titled “Recommended setup in Google Tag Manager (GTM)”
  1. In Fluentos, click Install Script next to the website, and click Copy next to the marketing script.
  2. In GTM, create a Custom HTML tag (for example Fluentos (Marketing)).
  3. Paste the Fluentos marketing script into the tag.
  4. Set the trigger to fire only when Marketing consent is accepted.
  1. Create a second Custom HTML tag (for example Fluentos (Analytics)).

  2. In the same dialog, click Copy next to the analytics script and paste it into the tag. It is this script:

    <!-- Fluentos Analytics -->
    <script nonce="9hmDFLK2hKG2OzPwMMSZlw==">
    window.fluentosAnalyticsConsent = true
    </script>
    <!-- End Fluentos Analytics -->
  3. Set the trigger to fire only when Analytics/Statistics consent is accepted.

Whitelist Fluentos in Your Content Security Policy (CSP)

Section titled “Whitelist Fluentos in Your Content Security Policy (CSP)”

A Content Security Policy (CSP) is a security setting that decides which scripts, styles and images may load on your website. It blocks everything it does not allow. If your CSP does not allow Fluentos, Fluentos may not load.

Add these to your CSP:

  • script-src: lets the Fluentos scripts load and run. The nonce-... part allows only inline scripts with this exact nonce, which keeps your website safe while the Fluentos DataHub works.

    Terminal window
    script-src 'nonce-9hmDFLK2hKG2OzPwMMSZlw==' https://*.fluentos.com https://*.youtube.com
  • connect-src: lets your website talk to Fluentos, to load campaigns and send analytics. Without it, Fluentos cannot send or receive the data its features need.

    Terminal window
    connect-src https://*.fluentos.com
  • style-src: allows the inline styles Fluentos uses to show campaigns.

    Terminal window
    style-src 'unsafe-inline'
  • img-src: lets images hosted by Fluentos load, so campaign images show to your visitors.

    Terminal window
    img-src https://*.fluentos.com