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.
Installation options
Section titled “Installation options”- 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.
Consent setup (important)
Section titled “Consent setup (important)”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.
Analytics/Statistics consent flag
Section titled “Analytics/Statistics consent flag”When the visitor accepts Analytics/Statistics consent, set this flag:
<!-- Fluentos Analytics --><script nonce="9hmDFLK2hKG2OzPwMMSZlw=="> window.fluentosAnalyticsConsent = true</script><!-- End Fluentos Analytics -->Single Page Applications (SPA)
Section titled “Single Page Applications (SPA)”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:
truewhen the visitor has accepted Analytics/Statistics consentfalsewhen the visitor has not accepted it, or has withdrawn it
Recommended setup in Google Tag Manager (GTM)
Section titled “Recommended setup in Google Tag Manager (GTM)”Step 1: Add the Marketing Script
Section titled “Step 1: Add the Marketing Script”- In Fluentos, click Install Script next to the website, and click Copy next to the marketing script.
- In GTM, create a Custom HTML tag (for example
Fluentos (Marketing)). - Paste the Fluentos marketing script into the tag.
- Set the trigger to fire only when Marketing consent is accepted.
Step 2: Add the Analytics Script
Section titled “Step 2: Add the Analytics Script”-
Create a second Custom HTML tag (for example
Fluentos (Analytics)). -
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 --> -
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. Thenonce-...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