Skip to main content
Lotame integration
Anastasiia Serebrianska avatar
Written by Anastasiia Serebrianska
Updated over 6 months ago

If you intend to utilize the Data Collection API aspects of Lotame and add predicted profiles as demographic variables please follow this guide for implementation.

Abstract

This integrations happens on the publisher side and requires our master script to be loaded to websites. Both inline or TAG-managers delivery are working perfectly. The master script typically looks like:

<script src="https://sak.userreport.com/youcompany/launcher.js" async id="userreport-launcher-script"></script>

For data, Lotame's Data Collection API you need to use Lotame advanced tag. The simpliest Lotame tag looks like this and it is assumed to be already deployed to your websites.

<script src="http://tags.crwdcntrl.net/c/0/cc.js?ns=_cc0" id="LOTCC_0"></script>
<script>
_cc0.bcp();
</script>

_cc0 is a tracker object, which depends on your Lotame account ID, and will be different for you.

Lotame does not allow to put labels on sent data and we are not allowed to provide demographics in plain text, therefore we are using semi-obfuscated key-values (see below)

Implementation

  1. In order to avoid any additional coding, our main script will set targeting data to localStorage cache and we provide a function that takes data from cache and sends to Lotame

  • it means that the first time we see users that have a predicted profile - the profile is cached but not sent to Lotame

  • the profile is sent to Lotame on all subsequent page views

After implementing our main script, your development team needs to integrate the below function into the Lotame snippet

Lotame function

Here is a function that takes data from cache and sends to Lotame

function addAudienceProjectDataToLotame(cc, prefix) {
var CACHE_KEY = "apr_lotame";
prefix = prefix ? prefix + ":" : "";
try {
var json = window.localStorage.getItem(CACHE_KEY);
if (json) {
var cache = JSON.parse(json);
if (cache.exp > Date.now()) {
cache.d.forEach(function (dem) {
cc.add("dem", prefix + dem);
});
}
else {
window.localStorage.removeItem(CACHE_KEY);
}
}
}
catch (err) {
window.localStorage.removeItem(CACHE_KEY);
}
}

This function needs to be called with your Lotame's _ccXX tracker prior to .bcp() call in your Lotame implementation. Like this:

<script src="http://tags.crwdcntrl.net/c/0/cc.js?ns=_cc0" id="LOTCC_0"></script>
<script>
/*
Following invocation will add AudienceProject demographic dimensions like
_cc0.add("dem", "gndr:m_150");
_cc0.add("dem", "yrs:30max_150");
*/
addAudienceProjectDataToLotame(_cc0);
_cc0.bcp();
</script>

If you want to put our dimensions into a separate bucket in Lotame, you can specify optional prefix, like following:

/*
Following invocation will add AudienceProject demographic dimensions like
_cc0.add("dem", "AudienceProject:gndr:m_150");
_cc0.add("dem", "AudienceProject:yrs:30max_150");
*/
addAudienceProjectDataToLotame(window._cc0, "AudienceProject");

Semi-obfuscation

Semi-obfuscation is a compromise between plain demographics and AudienceData default obfuscated key-values (e.g. ap_a:1, ab_b:3). Here are a few examples:

  • gndr - Gender

    • m - male

    • f_150 - female, affinity 150

  • yrs - Age

    • 1824 - from 18 to 24

    • 30max_150 - <30, affinity 150

    • 50min_200 - >50, affinity 200

You can request vocabulary from your account manager.

Testing

Integration is performed by the development team on publisher side, therefore we ensured that integration can be tested on non-production environment.

On our end we implemented the following debug helper to verify the implementation. You can fill the cache with fake data by entering page with our script present with parameter ?__sak_fakeads=1,3,5,random5 like http://example.com/?__sak_fakeads=1,3,5,random5. It will put key-values with ids 1, 3, 5 and random 5 from vocabulary. You can modify these parameters. Test scenario would be following:

  1. Add addAudienceProjectDataToLotame function and its invocation to Lotame snippet

  2. Enter http://example.com/?__sak_fakeads=1,3,5,random5 so something is put into cache

  3. Reload the page, so snippet will capture data from cache and send to Lotame

  4. Demographic variables should appear in Lotame (when size is sufficient in their eyes)

Further questions

If you are experiencing issue with implementing integrations send us request to [email protected] and our professional support team will help you.

Did this answer your question?