Plugin works in preview, NOT works in exported game

0 favourites
  • 8 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi,

    I am trying to develop a plugin for Gameanalytics.com

    I am using :

    https://github.com/orange-games/GA-JavaScript-SDK

    The problem is that the plugin I developed works perfect in preview mode but not on the exported version.

    The exported version works on itch.io website (still gives an error about crypto.js- a file the is placed on dependency) but doesn't on bitballoon.com

    The problem can be at the fact that the plugin needs 7 files listed on dependency?

    "dependency":   "cryptojs.d.ts;enc-base64-min.js;GaJavaScriptSdk.d.ts;GaJavaScriptSdk.js;GaJavaScriptSdk.js.map;GaJavaScriptSdk.min.js;hmac-sha256.js;"
    	[/code:2qk7a38n]
    on runtime.js:
    
    [code:2qk7a38n]//init
    	Acts.prototype.init= function(gameKey, secretKey,build)
    	{
    	var user = new GA.User();
        //Create an instance
        var gaan = GA.getInstance();
    	
    	gaan.init(gameKey, secretKey, build, user)
                .addEvent(new GA.Events.User())
                .addEvent(new GA.Events.Design('Game:Start'));
    	};
    	
    	//end init[/code:2qk7a38n]
    
    Can anyone with more experience in developing plugins can help me?
    
    Thanks
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There are 2 possible solutions:

    1. export project without "Minify"

    2. use ["prop"] instead of .prop . For example:

    GA.User -> window["GA"]["User"]

    gaan.init --> gaan["init"]

  • Thanks, I fixed it. It seams that the order of dependency assets does matter

  • It seams that now the plugin works only without minify.

    With minify option it doesn't work

    I tried to rewrite the code as follows but I guess I did it wrong:

    Can you see something wrong here:

    /*
    	var user = new GA.User();
        //Create an instance
        var gaan = GA.getInstance();
    	
    	gaan.init(gameKey, secretKey, build, user)
                .addEvent(new GA.Events.User())
                .addEvent(new GA.Events.Design('Game:Start'));
    	};
    	*/
    	
    	var user = window["GA"]["User"];
        //Create an instance
        var gaan = window["GA"]["getInstance"];
    	
    	gaan["init"](gameKey, secretKey, build, user)
                .addEvent(window["GA"]["Events"]["User"])]
                .addEvent(window["GA"]["Events"]["Design('Game:Start')"])];
    	};
    	[/code:1kdb79vv]
  • var user = new GA.User();

    -->

    var user = new window["GA"]["User"]();

  • Thanks

    and for:

    gaan.init(gameKey, secretKey, build, user)

    .addEvent(new GA.Events.User())

    .addEvent(new GA.Events.Design('Game:Start'));

    -> ???

  • gaan["init](...)["addEvent"](new window["GA"]["Events"]["User"]())["addEvent"]](new window["GA"]["Events"]["Design"](...))

  • Thanks. It works

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)