Last Event Counts, or LEC, helps advertisers use recent Daisycon event data in their own deduplication setup. It is especially useful when post view attribution is enabled, because a banner view does not set an advertiser-side cookie, click ID, or network flag by itself.
What is LEC?
LEC stands for Last Event Counts. It is a client-side Daisycon endpoint that can return recent Daisycon event data for a specific campaign and the visitor’s device or browser.
The endpoint can be used by advertisers to support deduplication logic. For example, an advertiser can trigger the endpoint on the visitor’s client and use the response to set or update an advertiser-side deduplication cookie.
When should LEC be used?
LEC is mainly used when post view attribution should be included in advertiser-side deduplication.
- The campaign uses post view attribution
- The advertiser uses deduplication between multiple affiliate networks
- The advertiser’s current setup depends on click cookies, click IDs, or network flags
- The advertiser wants to set its own deduplication cookie based on recent Daisycon event data
Why LEC is needed for post view attribution
Daisycon post view attribution is cookieless. When a user views a Daisycon banner, the view can be registered through the banner material request, but no advertiser-side cookie or network flag is set automatically.
This means a strict click-based deduplication setup may not recognize recent Daisycon activity when the user later visits the advertiser website directly. LEC helps solve this by making recent Daisycon event data available on the visitor’s client.
The LEC endpoint
The endpoint has the following structure:
https://<tracking_domain>/js/lec/?ci=<program_id>
-
<tracking_domain>is the Daisycon tracking domain used for the campaign -
<program_id>is the Daisycon campaign or program ID
The LEC endpoint returns JavaScript, not JSON. It should be loaded as a script on the visitor’s client. The response is made available through window.__dc_response.
Example response when a view is found
var __dc_response = {
"status": "G",
"status_description": "Matching event found",
"view": {
"timestamp": 1790000000,
"iso_date": "2026-01-01T10:00:00+02:00",
"media_id": 67890
}
}Example response when no view is found
var __dc_response = {
"status": "V",
"status_description": "No matching event found"
}How LEC works
A typical LEC-based deduplication flow works like this:
- A user sees a Daisycon banner on a publisher website
- The banner is loaded from Daisycon servers
- Daisycon registers the banner material request as view data
- The user later visits the advertiser website directly
- The advertiser triggers the LEC endpoint on the visitor’s client
- The LEC endpoint returns recent Daisycon event data for the campaign and device or browser, if available
- The advertiser uses the response to set or update its own deduplication cookie or attribution marker
- The user completes a conversion
- The advertiser’s deduplication setup allows Daisycon tracking to fire because recent Daisycon activity was detected
- Daisycon receives the conversion and checks for a valid click first
- If no valid click is available, Daisycon can evaluate the registered view for attribution
Example script: load LEC and store recent Daisycon activity
The example below loads the LEC endpoint, reads the response and stores a cookie when a matching Daisycon event is found.
This example is simplified and should be adapted to the advertiser’s website, tag management setup and deduplication rules.
<script>
(function () {
var trackingDomain = 'https://[matching_domain]';
var programId = '12345';
var cookieName = 'daisycon_recent_event';
var cookieMaxAgeSeconds = 5 * 24 * 60 * 60; // maximum view attribution window
function setCookie(name, value, maxAgeSeconds) {
document.cookie =
name + '=' + encodeURIComponent(value) +
'; Max-Age=' + maxAgeSeconds +
'; Path=/' +
'; SameSite=Lax' +
'; Secure';
}
function handleLecResponse(response) {
if (!response || !response.status) {
return;
}
if (response.status === 'G' && response.view) {
var cookieValue = JSON.stringify({
source: 'daisycon',
type: 'post_view',
program_id: programId,
media_id: response.view.media_id,
view_timestamp: response.view.timestamp,
view_iso_date: response.view.iso_date
});
setCookie(cookieName, cookieValue, cookieMaxAgeSeconds);
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'daisycon_recent_event_detected',
daisycon_event_type: 'post_view',
daisycon_program_id: programId,
daisycon_media_id: response.view.media_id,
daisycon_view_timestamp: response.view.timestamp,
daisycon_view_iso_date: response.view.iso_date
});
return;
}
if (response.status === 'V') {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'daisycon_recent_event_not_found',
daisycon_program_id: programId
});
}
}
function loadLec() {
window.__dc_response = undefined;
var script = document.createElement('script');
script.async = true;
script.src = trackingDomain + '/js/lec/?ci=' + encodeURIComponent(programId);
script.onload = function () {
handleLecResponse(window.__dc_response);
if (script.parentNode) {
script.parentNode.removeChild(script);
}
window.__dc_response = undefined;
};
script.onerror = function () {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'daisycon_lec_error',
daisycon_program_id: programId
});
};
document.head.appendChild(script);
}
loadLec();
})();
</script>Example script: read the stored LEC result on conversion
On the conversion page, the advertiser can read the stored LEC result and use it in their tag logic. The example below pushes the result to the data layer, so a tag management system such as Google Tag Manager can decide whether Daisycon tracking should fire.
<script>
(function () {
var cookieName = 'daisycon_recent_event';
function getCookie(name) {
var cookies = document.cookie ? document.cookie.split(';') : [];
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
if (cookie.indexOf(name + '=') === 0) {
return decodeURIComponent(cookie.substring(name.length + 1));
}
}
return null;
}
var recentEvent = getCookie(cookieName);
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'daisycon_conversion_deduplication',
daisycon_recent_event: recentEvent ? 'found' : 'not_found'
});
})();
</script>Example conversion logic
The advertiser can use the stored LEC result to decide whether Daisycon tracking should be considered on the conversion page.
- If recent Daisycon event data is found, the advertiser can allow the Daisycon conversion pixel to fire
- If no recent Daisycon event data is found, the advertiser can apply the agreed fallback rule
- When Daisycon receives the conversion, Daisycon still checks for a valid click first
- If no valid click is available, Daisycon can evaluate the registered view for attribution
LEC does not decide final attribution by itself. It only helps the advertiser include recent Daisycon event data in their own deduplication setup.
Google Tag Manager example
The following simplified version can be used as a starting point for a Custom HTML tag in Google Tag Manager. It only pushes the result to the data layer. Cookie handling and tag firing logic can then be managed separately in GTM.
<script>
(function () {
var trackingDomain = 'https://[matching_domain].com';
var programId = '12345';
window.__dc_response = undefined;
var script = document.createElement('script');
script.async = true;
script.src = trackingDomain + '/js/lec/?ci=' + encodeURIComponent(programId);
script.onload = function () {
window.dataLayer = window.dataLayer || [];
if (window.__dc_response && window.__dc_response.status === 'G' && window.__dc_response.view) {
window.dataLayer.push({
event: 'daisycon_recent_event_detected',
daisycon_event_type: 'post_view',
daisycon_program_id: programId,
daisycon_media_id: window.__dc_response.view.media_id,
daisycon_view_timestamp: window.__dc_response.view.timestamp,
daisycon_view_iso_date: window.__dc_response.view.iso_date
});
} else {
window.dataLayer.push({
event: 'daisycon_recent_event_not_found',
daisycon_program_id: programId
});
}
if (script.parentNode) {
script.parentNode.removeChild(script);
}
window.__dc_response = undefined;
};
document.head.appendChild(script);
})();
</script>Example scenarios
Scenario 1: recent Daisycon view found
- The user previously viewed a Daisycon-hosted banner
- The advertiser triggers LEC on the visitor’s client
- LEC returns
status: "G" - The advertiser stores a recent Daisycon event marker
- The user converts
- The advertiser allows Daisycon tracking to be considered
Scenario 2: no recent Daisycon view found
- The advertiser triggers LEC on the visitor’s client
- LEC returns
status: "V" - No recent Daisycon event marker is stored
- The advertiser applies the agreed fallback rule
Scenario 3: recent Daisycon click exists
- The user previously clicked a Daisycon affiliate link
- The user later converts
- Daisycon checks for a valid click first
- If the click is valid, click attribution has priority over view attribution
Relation to LCC
LEC is related to LCC, but it solves a different problem. LCC stores the latest click source. LEC makes recent Daisycon event data available on the visitor’s client, which is useful when post view attribution should be included in deduplication.
Use LCC for click-based deduplication. Use LEC when recent Daisycon post view event data should also be considered.
Read more: Network deduplication with Last Cookie Counts (LCC)
Important limitations
This example is meant to explain the concept. It is not a standard Daisycon script and should not be copied without review.
- LEC is not a reporting API
- LEC does not provide full view or impression statistics
- LEC only checks recent Daisycon event data for the selected campaign and local device or browser
- LEC does not replace the Daisycon conversion pixel
- LEC does not decide final attribution by itself
- Daisycon still checks for a valid click first when the conversion is received
Testing checklist
- Load a Daisycon-hosted banner and confirm that a recent event can be found through LEC
- Test a situation where no recent Daisycon event exists and confirm that
status: "V"is handled correctly - Check whether the advertiser-side cookie or marker is set only when expected
- Confirm that the Daisycon conversion pixel only fires according to the agreed deduplication rules
- Test the fallback rule when no recent Daisycon event is available
Conclusion
LEC makes recent Daisycon event data available on the visitor’s client. It is mainly used to support deduplication when post view attribution is enabled. It can help advertisers set their own deduplication cookie or attribution marker, but it should not be used as a reporting API or impression statistics endpoint.