Search Unity

CORS errors with WebGL builds

Discussion in 'Unity Analytics' started by finefin, Feb 10, 2021.

  1. finefin

    finefin

    Joined:
    Dec 13, 2013
    Posts:
    3
    I am getting CORS errors with WebGL builds that are using Unity Analytics and I don't really know where to look at in the first place to solve this :/

    In the js console it says the browser had blocked the url https://cdp.cloud.unity3d.com/v1/events
    And when I press the Data-Protection-Button that I implemented it sends me to some random url on my website that shows me a 404 page. please take a look https://www.spielfieber.net/downloads/H5/index.html

    When using a standalone build or playing in the editor, everything works as expected: Analytics events are logged and the button sends me to the data collection info page. Any ideas?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please share the specific error that you are seeing. What data protection button are you referring to? Sorry, I would choose not to click on external links for security reasons.
     
  3. finefin

    finefin

    Joined:
    Dec 13, 2013
    Posts:
    3
    "choose not to click on external links for security reasons" ... hah, yes of course! let me try to get more specific.

    the error message is:
    Code (JavaScript):
    1. Quellübergreifende (Cross-Origin) Anfrage blockiert: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf https://cdp.cloud.unity3d.com/v1/events. (Grund: CORS-Anfrage schlug fehl)
    And I attached an image of the button I'm talking about - it is the one that comes with the analytics package and I just dropped it in my stage, which works for standalone builds and also inside the editor.

    I'm using v2019.4.19f1
     

    Attached Files:

    Last edited: Feb 11, 2021
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Does it work without the button? I suspect you are referring to the data privacy button? It may not be supported on WebGL
     
  5. ateo_jan

    ateo_jan

    Joined:
    Jan 11, 2021
    Posts:
    5
    I get the exact same error message in my build. I have no data protection button