[
https://issues.apache.org/jira/browse/UNOMI-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15941618#comment-15941618
]
Serge Huber commented on UNOMI-88:
----------------------------------
Ok I think I understand what you're doing now.
Basically when serving an ad or a 1x1 image, you can generate the events to the
event collector. Until we fix the session requirement issue you could also
first load the context and create a session with something like this :
GET http://localhost:8181/cluster.json?sessionId=GENERATED_SESSION_ID
and then when calling the event collector you would simply do something like
POST http://localhost:8181/eventcollector?sessionId=GENERATED_SESSION_ID
In Javascript it would be something like this for the event collector payload:
data = JSON.stringify(events);
var url = "http://localhost:8181/eventcollector?sessionId=" +
generatedSessionId;
var xhr = new XMLHttpRequest();
var isGet = data.length < 100;
if ("withCredentials" in xhr) {
xhr.open("POST", url, true);
xhr.withCredentials = true;
} else if (typeof XDomainRequest != "undefined") {
xhr = new XDomainRequest();
xhr.open("POST", url);
}
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) {
return;
}
if (xhr.status == 200) {
var jsonResponse = JSON.parse(xhr.responseText);
successCallBack(xhr);
} else {
console.log("contextserver: " + xhr.status + " ERROR: " +
xhr.statusText);
if (errorCallback) {
errorCallback(xhr);
}
}
};
xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); // Use
text/plain to avoid CORS preflight
xhr.send(data);
I hope this help.
Regards,
Serge...
> Display Impression and Click Tracking
> -------------------------------------
>
> Key: UNOMI-88
> URL: https://issues.apache.org/jira/browse/UNOMI-88
> Project: Apache Unomi
> Issue Type: New Feature
> Reporter: Damon Henry
> Priority: Minor
>
> Can Unomi be used to track display advertising impressions and clicks?
> A common use case is the ability to embed 1x1 image pixels in banner ad
> creative to track when a banner has been viewed. A second use case it to use
> a redirect (e.g. http://myserver.com?redirect=http://somesite.com) in the
> banner ad creative to record when a link in an ad has been clicked.
> I investigated the /eventcollector endpoint but it appears a sessionId must
> appended prior which isn't possible if JavaScript tags are not supported by
> the ad server. Assuming the sessionId can be created by Unomi (every banner
> ad impression would be unique session), I'm unclear on how the event payload
> should supplied to the /eventcollector endpoint.
> Any direction you can provide is appreciated if Unomi can support this use
> case.
> Thanks
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)