kongregateUnitySupport is undefined

I’ve been trying to use the Kongregate stats api in my latest game, but I couldn’t make it work. The problem is that the object “kongregateUnitySupport” is always undefined.

I’ve tried with a web build, running it from Kongregate in both preview mode and after publishing it. I’m sending to the console the typeof of kongregateUnitySupport. The line of code that does that is:

Application.ExternalEval (“console.log(‘kongregateUnitySupport:’); console.log(typeof(kongregateUnitySupport));”);

You can see the message by yourself by going to Discover and Play Free Online Games on Kongregate! and opening the browser console.

I’ve also tried to use kongregateUnitySupport directly from the browser console but it remains undefined.

  1. What I’m missing?
  2. Can the stats api be tested in preview mode? I’ve read some people saying no and some people saying yes.

Note: I think the kongregate forum should be best to ask this, but haven’t got much luck there yet → http://www.kongregate.com/forums/90-kongregate-apis/topics/456673-kongregateunitysupport-is-undefined

I’ve solved the problem.
First, I didn’t read the docs where it said about iframe games having to manually initialise the api (my case). Here’s the doc: http://developers.kongregate.com/docs/api-overview/client-api

After having the api initialised, “kongregateUnitySupport” was still undefined so I’ve decided to use “kongregate.services.isGuest()” (I didn’t need the username just to check whether there was a logged user or not).