<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"></script>
<script>
window.axeptioSettings = {
clientId: "66137db6ae83de5e566cfc53",
cookiesVersion: "first-id sandbox-fr-EU",
};
(function (d, s) {
var t = d.getElementsByTagName(s)[0],
e = d.createElement(s);
e.async = false;
e.src = "//static.axept.io/tcf/sdk.js";
e.type = "module";
t.parentNode.insertBefore(e, t);
})(document, "script");
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{{ path('app_index') }}">{{ site_name }}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h3>First ID (Gate3 - Random UUID Redirect) : <span id="firstid"></span></h3>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
{% if not hasFirstId %}
<button id="redirectButton" class="btn btn-primary">Get First ID</button>
{% else %}
<p>You already have a First ID.</p>
{% endif %}
</div>
</div>
{% block body %}{% endblock %}
</div>
<script>
const FIRSTID_VENDOR_ID = 1178;
function listenForTCFConsent(callback) {
console.debug('Listening for TCF consent...');
if (!window.__tcfapi) return;
window.__tcfapi('addEventListener', 2, (tcData, success) => {
if (success && tcData.gdprApplies) {
if (tcData.vendor.consents[FIRSTID_VENDOR_ID] && tcData.eventStatus === 'useractioncomplete') {
console.log('User consented to the flex feature.');
callback();
} else {
console.log('User did not consent to the flex feature.');
}
} else {
console.log('__tcfapi failed to load or is not applicable.');
}
});
}
listenForTCFConsent(window.location.reload)
function getCookieValueFromCookieName(cookieName) {
let cookieArr = document.cookie.split(";");
for (let i = 0; i < cookieArr.length; i++) {
let cookiePair = cookieArr[i].split("=");
if (cookieName === cookiePair[0].trim()) {
return decodeURIComponent(cookiePair[1]);
}
}
return null;
}
function checkFirstidCookie() {
let firstidCookieValue = getCookieValueFromCookieName("firstid");
if (firstidCookieValue) {
console.log(`First ID : ${firstidCookieValue}`)
} else {
console.log('No First ID cookie found.')
}
}
function loadFirstIdSdk() {
var script = document.createElement('script');
script.src = "https://cdn.preprod.first-id.fr/sdk/loader/loader.min.js";
script.defer = true;
document.head.appendChild(script);
script.onload = function () {
window.firstId = window.firstId || {
callbacks: [],
debug: true,
cookieName: 'firstid'
};
window.firstId.callbacks.push(() => {
console.log('FirstID SDK loaded and initialized after user consent.');
});
window.firstId.callbacks.push(() => {
console.log(FIRSTID.get)
});
};
}
function checkConsentAndLoadSdk() {
let consent = getCookieValueFromCookieName('consent');
if (consent === 'yes') {
// loadFirstIdSdk();
}
}
checkConsentAndLoadSdk();
checkFirstidCookie();
let fid = getCookieValueFromCookieName('firstid')
if (fid) {
$('#firstid').text(fid)
} else {
$('#firstid').text('No First ID cookie found.')
}
document.getElementById('redirectButton')?.addEventListener('click', function() {
window.location.href = "{{ path('app_gate3_redirect') }}";
});
</script>
</body>
</html>