WebGL, CORS, and Unity Analytics

Hello,

My company has been using GameAnalytics for all our BI for the past year, but it has problems with WebGL so i’m testing integration of UnityAnalytics because you guys state WebGL is supported.

I find it strange that the very first call from UnityAnalytics.StartSDK, throws a CORS exception from the unity cloud…

here’s the request info from Chrome, you can see a 403 forbidden response…

403 web request error

403 Forbidden

  • Response Headersview source

  • Connection:
    keep-alive

  • Content-Length:
    689

  • Content-Type:
    text/html

  • Date:
    Thu, 02 Apr 2015 18:27:37 GMT

  • Server:
    CloudFront

  • Via:
    1.1 ef9db41d50967bc8b7cabdd9c12b11df.cloudfront.net (CloudFront)

  • X-Amz-Cf-Id:
    ZxQAS9IwHP9KkdEJLk6lxil8vTWt60DmqI2OwncDnWqfo1ulD0a_jg==

  • X-Cache:
    Error from cloudfront

  • Request Headersview source

  • Accept:

  • /*

  • Accept-Encoding:
    gzip, deflate, sdch

  • Accept-Language:
    en-US,en;q=0.8

  • Access-Control-Request-Headers:
    deviceid, accept, platform, sdk_ver

  • Access-Control-Request-Method:
    GET

  • Connection:
    keep-alive

  • Host:
    config.uca.cloud.unity3d.com

  • Origin:
    http://localhost

  • Referer:
    http://localhost/adcap-dev/

  • User-Agent:
    Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36

More Info

OPTIONS https://config.uca.cloud.unity3d.com/ff804760-3b57-40f3-800f-3a8a1f25a948.json adcap-dev.js:1 _JS_WebRequest_Sendadcap-dev.js:109 vRtadcap-dev.js:109 SJtadcap-dev.js:1 invoke_viiiadcap-dev.js:53 lBfadcap-dev.js:109 rJtadcap-dev.js:1 invoke_viiiiiiiiadcap-dev.js:61 grcadcap-dev.js:109 aLtadcap-dev.js:1 invoke_iiiiiiiiiadcap-dev.js:45 g9dadcap-dev.js:9 dIpadcap-dev.js:9 iIpadcap-dev.js:25 uEgadcap-dev.js:29 VNoadcap-dev.js:29 UNoadcap-dev.js:9 a9padcap-dev.js:109 wKtadcap-dev.js:1 invoke_iiiiadcap-dev.js:93 rVadcap-dev.js:93 ixadcap-dev.js:61 QIcadcap-dev.js:73 Yydadcap-dev.js:73 Wydadcap-dev.js:73 Yvdadcap-dev.js:73 Swdadcap-dev.js:73 Vwdadcap-dev.js:45 gceadcap-dev.js:9 QNpadcap-dev.js:9 PNpadcap-dev.js:29 RKoadcap-dev.js:29 QNoadcap-dev.js:29 PNoadcap-dev.js:29 qMoadcap-dev.js:29 mMoadcap-dev.js:29 zFoadcap-dev.js:29 aJoadcap-dev.js:29 _Ioadcap-dev.js:29 FJoadcap-dev.js:29 EJoadcap-dev.js:25 AEgadcap-dev.js:25 zEgadcap-dev.js:13 TDhadcap-dev.js:9 $8padcap-dev.js:109 wKtadcap-dev.js:1 invoke_iiiiadcap-dev.js:93 rVadcap-dev.js:93 ixadcap-dev.js:61 QIcadcap-dev.js:73 Yydadcap-dev.js:73 Xwdadcap-dev.js:73 Zwdadcap-dev.js:73 Ewdadcap-dev.js:61 KBcadcap-dev.js:109 UItadcap-dev.js:1 invoke_viiadcap-dev.js:77 Ycdadcap-dev.js:53 jBfadcap-dev.js:109 UJtadcap-dev.js:1 Runtime.dynCalladcap-dev.js:1 (anonymous function)adcap-dev.js:1 Browser.mainLoop.runIteradcap-dev.js:1 Browser_mainLoop_runner
(index):1 XMLHttpRequest cannot load https://config.uca.cloud.unity3d.com/ff804760-3b57-40f3-800f-3a8a1f25a948.json. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost’ is therefore not allowed access. The response had HTTP status code 403.

Hi @hyperhippo - could you tell me the version of SDK you are using?
You can check the version in Assets/Plugins/UnityAnalytics/version file.

The latest SDK (1.8.1) shouldn’t trigger an pre-flight OPTIONS request that was shown above.
Let me know if this is not the case.

I was on 1.5.1, trying 1.8.1 now…

yes updating 1.8.1 has removed the call. Thank you for the support :slight_smile:

Thanks for the update @hyperhippo - glad to know it’s working on 1.8.1 now :slight_smile: