Analytics and minify conflict

Discussion and feedback on Construct 2

Post » Sun Jun 15, 2014 11:59 am

When I export game in C2 as HTML5 website without minifying script and put Google Analytics tracking code into to HTML - everything is OK.
But:
When I export game in C2 as HTML5 website with minify script option ON and put Google Analytics tracking code into to HTML - the game starts to behave strange and unpredictably. For example "goto layout" doesn't work and animations doesn't change on some sprites.

I think that this is because minify (obfuscation) changes names of functions from "goToLayout(01);" to something like this "ga(01);", and google track code looks like this "ga('send', 'event', 'game', 'x', 'y');". So there may be conflicts with method names.
But that's only my guess.

Have you experienced any similar problems with Google Analytics.
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Mon Jun 30, 2014 8:18 pm

Anybody? Is there any way to make secure games with Google Analytics?
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Tue Jul 01, 2014 3:36 am

I found putting the tracking code inside a module and renaming the Google Analytics function worked:
https://www.scirra.com/forum/viewtopic.php?t=103498
B
30
S
7
Posts: 23
Reputation: 1,871


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests