Made easy
100% Free
Developer Documentation | API & Integration Guide - Hosted implementation
Overview
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.).
Domain binding & keys
- Each domain must be validated before use.
- Two access keys are issued per domain: development and production.
- Postbacks and configuration are bound to the domain.
Modes
- Automatic Implementation - Fully managed: content is blurred and an age dialog is displayed automatically.
- Controlled Implementation - You control the UX: you blur/unblur content and trigger the dialog yourself, while Go.cam handles verification and cookies.
Automatic Implementation
Include the script at the beginning of your <body> (so it can blur content immediately and render the dialog overlay).
<script type="application/javascript" src="https://avs-v2.dev.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>
What it does
- Blurs page content until verification completes.
- Shows an age confirmation dialog with a button to start verification.
- Creates a persistent cookie on the visitor’s device so verified users remain unlocked on future visits.
- Applies your configured colors and language (overridable via query params).
Query parameters (in the script URL)
- p (required): Your age verification account id.
- key (required): Your domain access key.
- language (optional, default en): e.g., en, fr, de, es, it, pt, etc.
- background, foreground, buttonBackground, buttonForeground: Hex values used to theme the dialog.
- autoStart=1 (required): Starts/attaches the hosted flow automatically on load.
Controlled Implementation
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://avs-v2.dev.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();
Notes for Controlled mode
- You are responsible for:
- Applying and removing the page blur.
- Deciding when to call AvsGoCamHosted.showOverlay() (e.g., on button click).
- Responding to success / error events to update your UI.
- Go.cam still:
- Runs the verification flow in the hosted overlay.
- Creates and manages the verification cookie on the device.
Example: Blurring / Unblurring Content in Controlled Mode
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();
}
Choosing a mode
| 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 |
Best practices
- Place automatic script early in body to avoid flicker before blur is applied.
- Use production keys only on production domains; keep development keys to staging/test domains.
- In controlled mode, ensure your blur/unblur logic is implemented and tied to the success event.
JavaScript API Reference
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();
Summary
| 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. |
Event Reference
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
});
Summary
| 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 |
Protect your business, your users, and your reputation
Choose GO.cam—the effortless, certified age verification solution for modern website operators.
Get Started Today!