koobazaur Posted August 25, 2016 Share Posted August 25, 2016 Hola, So I tried integrating GA into my latest game for some stats tracking based on official google docs. I got the page views and events working but my metrics show up as "not set" for some reason. Here's my set up: Here's the code I set up: TrackPageView: function(inPage, inTitle) { if(!this._IsInitted || !this._IsEnabled) { return; } ga('send', 'pageview', inPage); if(typeof inTitle !== 'undefined') { ga('set', 'title', inTitle); } console.log("GA PageView: [" + inPage + "][" + inTitle + "]"); }, TrackEvent: function(inCategory, inAction, inLabel) { if(!this._IsInitted || !this._IsEnabled) { return; } ga('send', 'event', inCategory, inAction, inLabel); console.log("GA Event: [" + inCategory + "][" + inAction + "][" + inLabel + "]"); }, //https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets TrackEventVar(inIndex, inValue) { if(!this._IsInitted || !this._IsEnabled) { return; } var i = 'metric' + inIndex; //ga('send', 'event', inCategory, inAction, { // i: inValue //}); ga('set', i, inValue ); console.log("GA EventVar: [" + i + " = " + inValue + "]"); }, And here's where I use it: sGA.TrackEventVar(1, Math.floor(playTime)); sGA.TrackEventVar(2, Math.floor(sStats.FollowerSpawnedTotal)); sGA.TrackEventVar(7, Math.floor(sStats.BlueFlowersCollected)); sGA.TrackEventVar(4, Math.floor(sStats.FollowersDied)); sGA.TrackEventVar(3, Math.floor(sStats.FlowersCollected)); sGA.TrackEventVar(5, Math.floor(sStats.BunniesKilled)); sGA.TrackEventVar(6, Math.floor(sStats.SnakesKilled)); sGA.TrackEvent("Game End", "GameEnd", "Game WON"); sGA.TrackPageView("/gather-game-end-win", "GATHER Game WON"); Both Event and PageViews report properly, and the metrics under "Audience -> Custom -> User Defined" show up as "(not set)" Any idea? Link to comment Share on other sites More sharing options...
koobazaur Posted August 30, 2016 Author Share Posted August 30, 2016 Bumpy! No thoughts? Link to comment Share on other sites More sharing options...
Chazlodian Posted August 30, 2016 Share Posted August 30, 2016 I have not worked with custom events, I'm curious if you've tracked activity in your network tab of a browser to see if data is being sent to google for your "sGA.TrackEventVar()" calls. Maybe they are responding with data or messages that could be helpful? Link to comment Share on other sites More sharing options...
koobazaur Posted September 4, 2016 Author Share Posted September 4, 2016 Seems so. The other events/pageviews are getting recorded properly. I didn't see any errors in my console. Link to comment Share on other sites More sharing options...
Recommended Posts