@shivateja_madipalli wrote:
website : "http://stage.artsocket.com"
My website is being tracked by Piwik and In my website to retrieve current visitors profile I am using "&method=Live.getVisitorProfile" and while retrieving the data, sometimes I am getting an empty json for first time visitor (a visitor visiting for first time) and if the same visitor visit the page again (refreshing the page) "&method=Live.getVisitorProfile" is retrieving the json value.
I guess this is because of cookie being saved on client (visitor's) browser.
My implementation is to bring visitor's profile and identify whether is it a first time visitor or returning visitor, accordingly I have to play with my JavaScript.
"var piwikUserDataFile = 'https://xx.xx.xx.xxx/piwik/index.php?module=API&method=Live.getVisitorProfile&visitorId=xxxxxxx&idSite=xx&format=json&token_auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';"
new Request.JSONP({url: piwikUserDataFile, callbackKey: 'jsoncallback',log:'true', onComplete: function(data){
console.log("Before decoding:"+data);
piwikDataDecode = JSON.decode(JSON.stringify(data));
console.log("After decoding:"+piwikDataDecode['lastVisits']);console.log("Visitor Type: "+piwikDataDecode['lastVisits'][0]['visitorType']); console.log("Referrer Name: "+piwikDataDecode['lastVisits'][0]['referrerName']); console.log("Device Type: "+piwikDataDecode['lastVisits'][0]['deviceType']); console.log("Country: "+piwikDataDecode['countries'][0]['prettyName']); console.log("Operating System Name: "+piwikDataDecode['lastVisits'][0]['operatingSystemName']); console.log("Browser Name: "+piwikDataDecode['lastVisits'][0]['browserName']); }).send();
This is how I am using the Live.getVisitorProfile() and retrieving JSONP value using Mootools Request.JSONP.
I am using Request.JSONP of MooTools (http://mootools.net/more/docs/1.5.2/Request/Request.JSONP)
This is acting sometimes weird with Win 10 + any browser.
and someother times with Mac + any browser.Please redirect me to right post on this or suggest me an answer.
Thank you!!
Posts: 1
Participants: 1