Search code examples
google-analyticsgoogle-analytics-apiuniversal-analytics

Custom metric is unable to display in Custom report after data import in google analytics


I have created custom metric named as "OrderValue" with scope type as a Hit and formatting type as an integer. The goal is to upload this metric value in GA against custom dimension. I have created One Custom Data Set and two .csv files are uploaded with given schema.

ga:dimension2,ga:metric3
864364158.1408537764,90
1300617200.1408542207,92
1877924069.1408542623,93
1907422855.1408542517,94
402600978.1408541946,95
53720731.1408542050,96
976341314.1408542697,97
1172524593.1408595931,98
188551773.1408595795,99
322956916.1408614851,100
1620242950.1408616228,101
2109954542.1408615793,102

Both csv files contain valid data, but in Custom reporting, The ordervalue is not reflected. Please note that I am planning to load the integer value in ga:metric3 against ga:dimension2. Is there some restriction on the type of values that go under custom dimensions. The value I have is “864364158.1408537764” which I think can be treated as string by GA.


Solution

  • Two things to ensure to get Data Import to work properly.

    1. The file must be uploaded before the hits are sent. The data gets joined at processing time.

    2. And ensure that the key metric, ga:dimension1 matches the values your are sending the hits.

      ga('create', 'UA-XXXX-Y', 'auto');
      
      // Set value for custom dimension at index 1.
      ga('set', 'dimension1', '864364158.1408537764');
      
      // Send the custom dimension value with a pageview, file already uploaded.
      ga('send', 'pageview');
      

    To answer your final question, the values of the custom dimensions are treated as strings, so there is no problem sending '864364158.1408537764'.