Using: Universal Analytics (analytics.js)
I'm currently tracking a custom dimension called 'animals' with an index of 3 and values 'pig' and 'cow'. I am trying to set up an application that can match user-input strings to their dimensionXX counterparts. For example, an input of 'animals' would match to 'dimension3'.
In addition, I'd like to be able to determine what values are held within this dimension, or at least output query data with these dimension values attached:
date | visits | dimension3 '2013-11-1' | 4 | 'pig' '2013-11-1' | 8 | 'cow' '2013-11-2' | 7 | 'pig' '2013-11-2' | 1 | 'cow' '2013-11-3' | 14 | 'cow'
I am trying to accomplish two things:
gapi.client.analytics.data.ga.get({ 'ids': 'ga:' + profileId, 'start-date': '2013-11-11', 'end-date': '2013-11-20', 'metrics': ???, 'dimensions': 'ga:dimension3', }).execute(callbackFunc);
I had considered using filters or segments but both yielded no results. Any ideas on how to get this to work?
This is currently not possible through the API. The only solution would be for you to manage this mapping yourself. You could use an array for this. Also, there is a feature request for this so you can upvote it and follow any status changes at https://code.google.com/p/analytics-issues/issues/detail?id=305
To identify values, what you have is close to correct: