How do I integrate Mixpanel into a C2 game for mobile?

Get help using Construct 2

Post » Wed Aug 20, 2014 7:44 pm

Hi Everyone,

I'm trying to get some good analytics in place using Mixpanel (required to work with a publisher I'm talking working with)

the first thing they want is to have me past a big block of code that looks like this:

<!-- start Mixpanel --><script type="text/javascript">(function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="//cdn.mxpnl.com/libs/mixpanel-2.2.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
mixpanel.init("bla bla bla token stuff...");</script><!-- end Mixpanel -->

since there's not HTTP: to this, i don't see how i could use ajax or websocket to pass this data.. this isn't a .js file so i'm wondering how i could maybe set this up to be in a .js file and then of course.. how the heck I could access that js file!? :)

NOTE: Also I found it incredible that not one prior post about mixpanel was mentioned. Its a really nice service and does a lot of cool stuff and has a free version so it seems like a really nice solution for folks. I know there is google analtyics, but this feels a little more developed for monetization than what I've seen with GA.

Thanks!
Caleb
B
59
S
9
G
1
Posts: 946
Reputation: 6,561

Post » Wed Aug 20, 2014 7:59 pm

Browser execute javascript should work..

But it might be better to create a custom plugin for it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests