DFP Multi-request - Initiation Time - google-dfp

Am using DFP for rendering ads in a website. In DFP i have configured multiple ads vendors.For the purpose of reporting i need to save when request to each slot is generated. How can i find when the request for the each slot is generated . Am using DFP Multi-request mode.
Thanks In Advance

You can use SlotRenderEndedEvent.
Docs: https://developers.google.com/doubleclick-gpt/reference#googletageventsslotrenderendedevent
googletag.cmd.push( function() {
googletag.pubads().addEventListener('slotRenderEnded', function(data) {
//saving data..
console.log(new Date().getTime());
console.log(data.creativeId);
});
});

Related

Is it possible to display data from SeatGeek API call on my Squarespace site?

Is it possible to connect to the SeatGeek API to display local event data on a Squarespace site?
The Squarespace API docs all seem directed towards commerce-related goals.
I am familiar with how to connect to the SeatGeek API in the context of a mobile application. But I don't know whether connecting to APIs (other than those listed for commerce) from within a Squarespace is doable.
SeatGeek would be an unofficial integration . I've posted on the squarespace forums with no response, so asking here to see if anyone out there knows about it.
Thanks very much for any help!
Squarespace websites above the "Personal" plan tier support the addition of custom JavaScript via Code Blocks and Code Injection.
Therefore, if SeatGeek supports using their API via JavaScript (and it appears that they do), then you can obtain the data from within your Squarespace website.
Where within your site the code is added and what initialization methods are used will vary on a case-by-case basis. For example, factors include: whether you are using Squarespace 7.0 or 7.1 and whether the template you're using supports AJAX Loading and has it enabled.
However, regardless of where the code is added and the initialization methods used, it looks to me, based on what I see here, that obtaining data from SeatGeek via JavaScript is possible. (Select "JavaScript > XMLHttpRequest" or "JavaScript > Fetch" from the upper-right "Code Snippet" panel where it says "(Node.js) Unirest" by default):
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://seatgeek-seatgeekcom.p.rapidapi.com/events");
xhr.setRequestHeader("x-rapidapi-host", "seatgeek-seatgeekcom.p.rapidapi.com");
xhr.setRequestHeader("x-rapidapi-key", "SIGN-UP-FOR-KEY");
xhr.send(data);
Or, via fetch:
fetch("https://seatgeek-seatgeekcom.p.rapidapi.com/events", {
"method": "GET",
"headers": {
"x-rapidapi-host": "seatgeek-seatgeekcom.p.rapidapi.com",
"x-rapidapi-key": "SIGN-UP-FOR-KEY"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
While it varies on a case-by-case basis, in most cases you'll want to use the sitewide code injection area vs. code blocks or page-level code injection. Then, on Squarespace 7.0 sites, you'll want to wrap your code in:
window.Squarespace.onInitialize(Y, function() {
// do stuff here
});
For Squarespace 7.1 sites on the other hand, one would usually wrap the code in:
document.addEventListener('DOMContentLoaded', function() {
// do stuff here
}, false);
Finally, you'll need to think about how you're outputting the data. You could either add HTML markup via a Code Block in the body of the target page, or add the markup to the page as part of your JavaScript.

Deezer api options streaming duration

I'm getting some data of my Deezer account. When I'm trying to fetch my streaming_duration, it returns 0.
Besides, Deezer documentation is not accurate.
Does someone know why is this returning 0 ? Is this seconds or minuts?
My code is the following one :
$.ajax({
url: 'https://api.deezer.com/user/'+userid+'/options?access_token='+access_token,
success: function(response) {
console.log('Duration '+response.streaming_duration);
}
});
Deezer devs answered me by e-mail
The option streaming_duration is deprecated.

IBM Bluemix AppID - how log off / log out?

When using IBM Bluemix App ID, does anyone know how to log out a user? The Node.js server SDK on GitHub sample application and README includes this reference:
const LOGOUT_URL = "/ibm/bluemix/appid/logout";
I have tried various permutations but I haven't been able to find out what URL to use to log out the user (both hostname and extension).
Can anyone help, please?
Many thanks.
According to a posting at https://www.ibm.com/developerworks/library/iot-trs-secure-iot-solutions3/index.html , 'There is no explicit "logout" method at time of writing of this article'.
Having done some digging, killing the session will provide logout functionality. This can be achieved in Node.js with the following:
app.get("/logout", function(req, res){
// Destroy the session
req.session.destroy();
//return the main html file
res.sendfile(__dirname + '/views/index.html');
});
To log out the user, you can use the WebAppStrategy on your logout endpoint like the following:
app.get("/logout", function(req, res, next) {
WebAppStrategy.logout(req);
// If you chose to store your refresh-token, don't forgot to clear it also in logout:
res.clearCookie("refreshToken");
res.redirect("/");
});
Look at the Node SDK readme on WebAppStrategy https://github.com/ibm-cloud-security/appid-serversdk-nodejs.

Facebook-login issue

This is our link for the fb or old way sign-in: http://www.greeceinsiders.com/login
Does the fb-login work to you? When I click it it redirects me to the same page.
Sometimes it works sometimes not. When a user logs in with fb we collect his vredentials sucha as email,city, name in our mysql database. Does anybody had the same problem? Is there any good tutorial out there, that explains it step by step and is for the current fb api?
Any suggestions or feedback is welcome, thank you! Some code
FOUND IT!
I like to use the FB.login method. This allows me to set the permissions that I want (such as email) and access the info on my server through a Facebook library like https://github.com/facebook/php-sdk. There are also good tutorials on https://developers.facebook.com/docs/authentication/:
FB.login(
function(response) {
if (response.authResponse) {
$.ajax({
url: Global.base_url + 'user/facebook_log_in/',
dataType: 'json',
success: function(data) {}
});
}
else {
// Display facebook error
}
},
{
scope: 'email'
});

Set up facebook UrchinTracker for aJax calls for Google Analytics

I have set up the Google Analytics in my FBML facebook application. It works for tracking the php pages. (I can see the report in GA).
However, I also want to track the aJax calls, because most of the pages of my application is ajax driven, rather than loading differnet php pages.
so, that's what I put in the code (before ajax call)
Facebook.urchinTracker('/importantpage/');
THere is no error return when running the application.
However, when I look at the Google Analytics, I can't find any report showing this is being tracked. I look at the Event tracking.. nothing. I look at the overview, it only shows the php pages statistic.
So, where should I look in Google Analytics? and do I need to set up anything in GA for tracking the ajax call for 'importantpage' ?
try calling urchin within you AJAX function. Like :
function callPage(div,params, page)
{
Facebook.urchinTracker(page);
var ajax_content = new Ajax();
ajax_content.responseType = Ajax.FBML;
ajax_content.ondone = function(data)
{
document.getElementById(div).setInnerFBML(data);
}
var params={"Params":params,"target":div};
ajax_content.post(page,params);
}