0 Favourites

Plugin works in preview, NOT works in exported game

  • 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
  • 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"]

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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:

    @rexrainbox

    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"]();

  • rexrainbox

    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)
Similar Topics Posts Views Last Post
Unread sticky
4,517 857,344
Tinimations's avatar
Tinimations
Unread hot topic
1,068 148,660
Reflextions's avatar
Reflextions
Unread sticky
1,586 437,295
matriax's avatar
matriax