Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by coreysnyder

Before I add a ton of events to the game, has anyone else used playtomic & Ejecta together? My only concern is whether or not it uses compatible code to make HTTPRequests. I hope it does. If I don't get a response, I'll report back with my findings in the coming days.

1 decade ago by neogope

Actually I've tried to integrate it. For me it didn't work with the Javascript version inside the App (on tests in the browser, with the plain ImpactJS App it worked fine). Obviously there is no other solution than using the Obj. C API (https://playtomic.com/api/ios) which should work fine, but honestly until now I was to lazy/had other things to do than integrating it this way, so .. no clue. It is still on my to-do-list, if I successfully integrate it before you, I will let you know how I did it ;)

If you want to give it a try, you can extend Ejecta like this:
http://impactjs.com/ejecta/extending-ejecta

Btw: If anyone knows a way to integrate the (for me much more simpler ;) ) JS API into a finished App, I would be very interested in that way :)

1 decade ago by coreysnyder

Ok I tested this tonight and found that the Playtomic doesn't blow up. It just doesn't successfully send any information to Playtomic API.

The one main thing I was concerned with was the initialization of Playtomic looks like:
Playtomic.Log.View(
	'XXXXX2',
	'6XXXXX9fe4dc7',
	'aXXXXXX83897d06e12f24d0',
	document.location
);

And since the document is "faked" I wasn't sure if it had a location. Maybe instead I could hardcode document.location to:

{
        hash: "#",
        host: "ZombieHoldidayApp",
        hostname: "ZombieHoldidayApp",
        href: "ZombieHoldidayApp",
        origin: "ZombieHoldidayApp",
        pathname: "/",
        port: "",
        protocol: "http:",
        search: ""
    }

Maybe Dominic can shed some light on if that is available?

1 decade ago by coreysnyder

Considering I have zero knowledge of how to write objective-c I think that I'm going to have a really tough time extending ejecta to use the Playtomic iOS API. If anyone else has experience in this and could help out, that would be great!

In the mean time. I'm going to add a bunch of logging to Playtomic API and figure out why its not throwing errors, but its not sending the event.

1 decade ago by coreysnyder

Here's what the XHR Requests look like from iOS:
xhr, {"readyState":0,
"timeout":0,
"DONE":4,
"status":0,
"HEADERS_RECEIVED":2,
"responseType":"",
"LOADING":3,
"UNSENT":0,
"statusText":"0",
"OPENED":1}

Here's what they look like in FF:
xhr {"statusText":"",
"status":0,
"response":"",
"responseType":"",
"responseXML":null,
"responseText":"",
"upload":{"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null},"withCredentials":false,"readyState":0,"onreadystatechange":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null} 

So clearly there's a problem making the XHR request. I'm not really sure why though. Here's the code I'm making the call with:

var url = URLStub + "tracker/q.aspx?swfid=" + SWFID + "&q=" + Data.join("~") + "&url=" + SourceUrl + "&" + Math.random() + "z";
console.log('send url', url);

if (XMLHttpRequest) {
    var xhr = new XMLHttpRequest();
    console.log('xhr', JSON.stringify(xhr));
    if("withCredentials" in xhr) {
        console.log('withCredentials in xhr');
        //trace("with xhr");
        xhr.open("get", url, true)
        xhr.send();
        return;
    }
}

1 decade ago by coreysnyder

HIP HIP, HORRAY! I got it working with the help of a friend. Either he or I will post the updated Playtomic.v2.2.js file to GitHub.

1 decade ago by neogope

Congrats! How did you do it?

1 decade ago by coreysnyder

Well I'm working off my buddies forked repository of Playtomic, so I don't know what all he's changed, but I think the magic was to bypass the "withCredentials" line. I don't know if this is going to bite me in the ass down the road for any reason, but I am seeing the events showing up in the playtomic UI and I've confirmed they are definitely coming from my iOS device.

if(true || "withCredentials" in xhr) {   // Auto evaluates to true.
        console.log('withCredentials in xhr');
        //trace("with xhr");
        xhr.open("get", url, true)
        xhr.send();
        return;
    }

1 decade ago by coreysnyder

So I've been tracking analytics across my 20+ beta testers through test-flight and it seems to work!

1 decade ago by Rinn

Hi corey,
Do you mind posting a link to your updated Playtomic.v2.2.js file? I'm having troubles adding Playtomic into my code, I don't seem to be recieving data from Playtomic.....

Thanks!

1 decade ago by coreysnyder

Sorry Rinn, here's the link: https://github.com/coreysnyder04/Playtomic-ImpactJS-Ejecta

Please let me know if you have any issues. Also make sure your phone is on wifi/wireless network. Also I noticed it has a delay of about 15 minutes before it shows up in your UI. I'd test on your PC ot make sure any events are making it in. If so, then run it on the iPhone.
Page 1 of 1
« first « previous next › last »