Fácil e seguro
100% Grátis
The Hosted Implementation is a frontend-only way to integrate Go.cam, requiring just a script include. It manages verification UI and device cookies on your behalf and applies your domain-bound configuration (theme, language, verification types, etc.).
Include the script at the beginning of your
(so it can blur content immediately and render the dialog overlay).
<script type="application/javascript" src="https://go.cam/static/js/app/avsHosted.js?p={Age verification account id}&key={Site key}&background={Overlay background}&foreground={Overlay color}&buttonBackground={Overlay button background}&buttonForeground={Overlay button color}&language={Language code}&autoStart=1"></script>
Include the script at the beginning or end of your <body>. In this mode you handle when to blur/unblur and when to open the overlay.
<script type="application/javascript" src="https://go.cam/static/js/app/avsHosted.js?p={Age verification account id}&key={Site key}&language=en"></script>
Create a button that triggers age verification (example uses #checkAgeButton):
<button id="checkAgeButton">Check my age</button>
Hook up initialization, trigger, and event handling:
// listen to a success event
AvsGoCamHosted.event.on('success', () => {
// age was verified with success, remove the website blur
});
// listen to a error event
AvsGoCamHosted.event.on('error', (error) => {
// age was verified with error, try again
});
// add a click action to the age check button
document.querySelector('#checkAgeButton').addEventListener('click', () => {
AvsGoCamHosted.showOverlay();
});
// initialize the library
AvsGoCamHosted.start();
1. Add CSS for the blur effect
.blurred {
filter: blur(8px);
}
#blurOverlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
z-index: 9998;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 1.2em;
}
#checkAgeButton {
z-index: 9999;
position: relative;
padding: 10px 20px;
font-size: 1em;
cursor: pointer;
}
2. Wrap your content in a container
<div id="pageContent" class="blurred">
<!-- Your website content goes here -->
<h1>Welcome to my website</h1>
<p>This content is blurred until age verification succeeds.</p>
</div>
<!-- Overlay with trigger button -->
<div id="blurOverlay">
<button id="checkAgeButton">Verify your age</button>
</div>
3. Add JavaScript logic
function applyBlur() {
document.querySelector('#pageContent').classList.add('blurred');
document.querySelector('#blurOverlay').style.display = 'flex';
}
function removeBlur() {
document.querySelector('#pageContent').classList.remove('blurred');
document.querySelector('#blurOverlay').style.display = 'none';
}
// if local cookie is not set already, start the verification flow
if (!AvsGoCamHosted.isAlreadyGoCamVerified()) {
// apply blur until a success event is received
applyBlur();
// listen to a success event
AvsGoCamHosted.event.on('success', () => {
removeBlur();
});
// listen to a error event
AvsGoCamHosted.event.on('error', (error) => {
applyBlur();
});
// listen to a click event on the check age button
document.querySelector('#checkAgeButton').addEventListener('click', () => {
AvsGoCamHosted.showOverlay();
});
// initialize the library
AvsGoCamHosted.start();
}
Mode | Setup Effort | Who controls UI/blur? | Cookie handling | Best for |
---|---|---|---|---|
Automatic | Minimal | Go.cam | Automatic | Fastest path to production |
Controlled | Moderate | You | Automatic | Custom UX and precise timing |
When using the Hosted Implementation, the Go.cam library exposes several methods to help you control the verification flow programmatically.
These methods are available globally via the AvsGoCamHosted object.
start()
Description
Initializes the Hosted library. This must be called once after the script is included to set up event listeners and internal logic.
AvsGoCamHosted.start();
showOverlay()
Description
Opens the Go.cam verification iframe as an overlay on top of your website.
AvsGoCamHosted.showOverlay();
hideOverlay()
Description
Closes the Go.cam verification iframe overlay, without affecting the user’s verification status.
AvsGoCamHosted.hideOverlay();
forceVerification()
Description
Clears the local verification cookie so the user must complete verification again. After calling this method, you must reload the page for the change to take effect.
AvsGoCamHosted.forceVerification();
window.location.reload();
isAlreadyGoCamVerified()
Description
Checks whether a local verification cookie exists, i.e., whether the user has already been verified on this device.
AvsGoCamHosted.isAlreadyGoCamVerified();
Method | Purpose |
---|---|
start() | Initializes the Hosted SDK (must be called once). |
showOverlay() | Opens the Go.cam verification iframe overlay. |
hideOverlay() | Closes the verification iframe overlay./td> |
forceVerification() | Clears the local cookie (requires page reload) to force re-chec |
isAlreadyGoCamVerified() | Returns true/false depending on whether the user is verified. |
The AvsGoCamHosted library provides a set of events you can listen to in order to react to key points in the verification process.
Use the following syntax to subscribe to events:
AvsGoCamHosted.event.on('{eventName}', callback);
success
Description
Triggered when the age verification process completes successfully.
AvsGoCamHosted.event.on('success', () => {
// Handle success
});
error
Description
Triggered when the verification process fails or an error occurs.
AvsGoCamHosted.event.on('error', (error) => {
// Handle error
});
ready
Description
Triggered once the Hosted SDK has been initialized and is ready to be used.
AvsGoCamHosted.event.on('ready', () => {
// SDK is ready
});
resourcesLoaded
Description
Triggered when all necessary verification resources (scripts, models, etc.) are fully loaded. At this point, the overlay is ready to be displayed.
AvsGoCamHosted.event.on('resourcesLoaded', () => {
// Resources are ready
});
closed
Description
Triggered when the user closes the verification iframe overlay.
AvsGoCamHosted.event.on('closed', () => {
// Overlay closed
});
Event Name | Triggered When | Callback Parameter |
---|---|---|
success | Verification completes successfully | none |
error | Verification fails or an error occurs | object with error details, eg: {code: 123, msg: 'Error message'} |
ready | SDK is initialized and ready | none |
resourcesLoaded | All required verification resources are loaded | none |
closed | Verification overlay is closed by the user | none |
Escolha GO.cam — a solução simples e certificada de verificação de idade confiável pelos operadores de sites atuais.
Comece hoje!