LT.js Implementation FAQs
OVERVIEW
Gain a deeper understanding of Lightning tag and how it works through these common questions and answers.
Why don't I see audiences being sent to my ad-serving solution?
Here are some things to check. These will all involve opening up developer tools in a browser and looking at the network tab.
- Do you have the onProfileReady callback handler set up to pass the data received from Lotame to your ad-serving solution?
- Look for a call to the Lotame servers that looks like https://bcp.crwdcntrl.net/6/data
- Look for calls to your ad-serving solution and ensure that these calls come after the the above calls.
- If you are using Google, ensure that the call to Lotame above finishes before enableServices is called.
- If you still need assistance, please reach out to Lotame by submitting a Support ticket form through this link.
How do I make sure that the newest Lotame audiences are included in my ad calls?
Make sure that the onProfileReady() event is fired before rendering your ads. The following script shows how to wait for up to a certain amount of time (500ms in the example) to allow Lotame's audience processing to complete before making the ad requests on the page. In the unlikely case that Lotame's new audiences are not returned in that time, any audiences stored in local storage from a previous call will be used.
<head>
<link rel="preconnect" href="https://tags.crwdcntrl.net">
<link rel="preconnect" href="https://bcp.crwdcntrl.net">
<link rel="preconnect" href="https://c.ltmsphrcl.net">
<link rel="dns-prefetch" href="https://tags.crwdcntrl.net">
<link rel="dns-prefetch" href="https://bcp.crwdcntrl.net">
<link rel="dns-prefetch" href="https://c.ltmsphrcl.net">
<script>
var targetAndDisplayAds = function(audienceArray) {
console.log('Replace with implementation that calls googletag or other ad-rendering capabilities');
}
! function() {
var lotameClientId = '<lotameClientId>';
var audLocalStorageKey = 'lotame_' + lotameClientId + '_auds';
// Adjust this timing as needed
var maxAudienceWaitMillis = 500;
// Set up fallback logic if timeout is reached
var audienceReadyTimeoutId = window.setTimeout(function() {
var localStorageAudiences = [];
try {
var tempAudiences = window.localStorage.getItem(audLocalStorageKey) || '';
if (tempAudiences) {
localStorageAudiences = tempAudiences.split(',');
}
} catch(e) {
} finally {
targetAndDisplayAds(localStorageAudiences);
}
}, maxAudienceWaitMillis);
var audienceReadyCallback = function(profile) {
// Get audience string & Call your company's Ad Display function
var lotameAudiences = profile.getAudiences() || [];
// Cancel the timeout
window.clearTimeout(audienceReadyTimeoutId);
targetAndDisplayAds(lotameAudiences);
};
// Lotame Config
var lotameTagInput = {
data: {},
config: {
audienceLocalStorage: audLocalStorageKey,
onProfileReady: audienceReadyCallback
}
};
// Lotame initialization
var lotameConfig = lotameTagInput.config || {};
var namespace = window['lotame_' + lotameClientId] = {};
namespace.config = lotameConfig;
namespace.data = lotameTagInput.data || {};
namespace.cmd = namespace.cmd || [];
} ();
</script>
<script async src="https://tags.crwdcntrl.net/lt/c/<lotameClientId>/lt.min.js"></script>
</head>
If you still need assistance, please reach out submitting a Support ticket form through this link.
What should I do if my site is a Single Page Application?
If your site is a Single Page Application or if you have sections of your site that dynamically refresh their content without reloading the page, then you should follow the instructions below to make sure that you correctly capture all data points across all your pages.
First, find the appropriate implementation for your use case under Implementation Guides.
Then, when the content of a page has finished dynamically refreshing, execute the page() call on your lotame namespace as described here: Page Function. This will perform the full new page handling including running any additional data collection rules that match the updated content.
How can I access Lotame's profile id in my browser?
In the onProfileReady callback, you can retrieve the latest profile id for the browser by using the getProfileId() function described at Audience Callback.
How can I limit the number of audiences returned?
Our servers will always return the complete set of audiences that your user qualifies for. However, you can limit the number of audiences you use through the following methods:
In the onProfileReady callback, the profile object has both getAudiences() and getAudiencesString() functions which accept a limit parameter as follows
var audienceReadyCallback = function (profile) { var limit = 1000; // Get audiences as an array var lotameAudiences = profile.getAudiences(limit) || []; }; // Lotame Config var lotameTagInput = { data: {}, config: { clientId: <lotameClientId>, audienceLocalStorage: true, // written to 'lotame_<lotameClientId>_auds' key onProfileReady: audienceReadyCallback } };
When retrieving from local storage, you can use the following snippet to limit the number returned
var localStorageAudiencesRaw = localStorage.getItem('lotame_<lotameClientId>_auds') || ''; var localStorageAudiences = localStorageAudiencesRaw.split(','); var maxItems = 1000; var targetingList = localStorageAudiences.slice(0, maxItems);
How can I prioritize which audiences are returned first?
Sequence your audiences being passed through an ad call to an ad server, such as Google Ad Manager. This ensures audiences will return in order of ranked priority avoiding exclusion based on the character limitations of the ad server.
Audience priority can be set directly in the platform. When enabling an audience for client-side extraction, simply set the desired priority. Options include:
- Priority 1
- Priority 2
- Priority 3
- Not Prioritized (default)
What is the size of Lightning Tag?
The base LT.js script is ~15kb in size. Its size is custom to each client's implementation and increases slightly based on how many data collection rules are used.
Content aside
Categories
- 2 yrs agoLast active
- 1880Views
- 1 Following