Links

SDK with LightCMP

Deployment routes
To implement Gravito LightCMP on your website (or app inside a webview), you will need CMP configuration first. Usually you will get it generated for you by Gravito Admin Portal or you will be handed pre-made configuration. For testing and reference purposes you can review one configuration here.
After configuration is defined on your site:
<script>
var customCSS="";
var gravitoCMPConfig = {...}
window.gravitoCMPConfig = gravitoCMPConfig;
</script>
You can continue by implementing the CMP loading. Examples on this page should work either directly from page template or via Google Tag Manager custom HTML tag.
LightCMP as a standalone deployment (consents are stored to local client-side cookie):
<script>
var gravitoSdkTag = document.createElement("script");
gravitoSdkTag.src = "https://cdn.gravito.net/sdk/gravitoSDK_latest.js";
gravitoSdkTag.onload = function () {
window.gravito.ready(function () {
gravito.initLightCMP(
"https://cdn.gravito.net/lightcmp",
"bundle_latest_2"
);
});
};
document.body.appendChild(gravitoSdkTag);
</script>
Replace “bundle_latest_2” with the version you want to use, latest refers to automatically updating latest version of the major release (2.x.x). If you don’t pass any value CMP will use the latest version of core libraries by default.
Next option, same deployment as above (stand-alone) but with Google Consent Mode enabled (requires some special wiring):
<script>
var gravitoSdkTag = document.createElement("script");
gravitoSdkTag.src = "https://cdn.gravito.net/sdk/gravitoSDK_latest.js";
gravitoSdkTag.onload = function () {
window.gravito.ready(function () {
gravito.initLightCMPWithGCM(
"https://cdn.gravito.net/lightcmp",
"bundle_latest_2"
);
});
};
document.body.appendChild(gravitoSdkTag);
</script>
Replace “bundle_latest_2” with the version you want to use, latest refers to automatically updating latest version of the major release (2.x.x). If you don’t pass any value CMP will use the latest version of core libraries by default.
LightCMP with Gravito API integration (consents are stored to Gravito profile):
<script>
var gravitoSdkTag = document.createElement("script");
gravitoSdkTag.src = "https://cdn.gravito.net/sdk/gravitoSDK_latest.js";
gravitoSdkTag.onload = function () {
window.gravito.ready(function () {
gravito.initLightCMPWithBackend(
"https://cdn.gravito.net/lightcmp",
"https://handshake.gravito.net",
"bundle_latest_2"
);
});
};
document.body.appendChild(gravitoSdkTag);
</script>
Replace “bundle_latest_2” with the version you want to use, latest refers to automatically updating latest version of the major release (2.x.x). If you don’t pass any value CMP will use the latest version of core libraries by default.
Replace "https://handshake.gravito.net" with custom endpoint URL if you have any, e.g. first party set and configured.
NOTE: Make sure you have withBackendIntegration:true in gravitoCMPConfig
LightCMP with Google Consent Mode and Gravito API integration:
<script>
var gravitoSdkTag = document.createElement("script");
gravitoSdkTag.src = "https://cdn.gravito.net/sdk/gravitoSDK-v1.0.8.js";
gravitoSdkTag.onload = function () {
window.gravito.ready(function () {
gravito.initLightCMPWithBackendandGCM(
"https://cdn.gravito.net/lightcmp",
"https://handshake.gravito.net",
"bundle_latest_2"
);
});
};
document.body.appendChild(gravitoSdkTag);
</script>
NOTE: Make sure you have withBackendIntegration:true in gravitoCMPConfig
Replace "https://handshake.gravito.net" with custom endpoint URL if you have any, e.g. first party set and configured.