analytics.js
function metrics(obj, data) {
  var dimensions = data.dimensions;
  var metrics = data.metrics;
  var names = keys(metrics).concat(keys(dimensions));
  var ret = {};

  for (var i = 0; i < names.length; ++i) {
    var name = names[i];
    var key = metrics[name] || dimensions[name];
    var value = dot(obj, name) || obj[name];
    if (value == null) continue;
    ret[key] = value;
  }

  return ret;
}
function metrics(obj, data) {
  var dimensions = data.dimensions;
  var metrics = data.metrics;
  var names = keys(metrics).concat(keys(dimensions));
  var ret = {};

  for (var i = 0; i < names.length; ++i) {
    var name = names[i];
    var key = metrics[name] || dimensions[name];
    var value = dot(obj, name) || obj[name];
    if (value == null) continue;
    ret[key] = value;
  }

  return ret;
}
function metrics ( obj , data ) { var dimensions = data . dimensions ; var metrics = data . metrics ; var names = keys ( metrics ) . concat ( keys ( dimensions ) ) ; var ret = { } ; for ( var i = 0 ; i < names . length ; ++ i ) { var name = names [ i ] ; var key = metrics [ name ] || dimensions [ name ] ; var value = dot ( obj , name ) || obj [ name ] ; if ( value == null ) continue ; ret [ key ] = value ; } return ret ; }
Map google's custom dimensions & metrics with `obj`.

Example:

metrics({ revenue: 1.9 }, { { metrics : { revenue: 'metric8' } });
// => { metric8: 1.9 }

metrics({ revenue: 1.9 }, {});
// => {}

@param {Object} obj
@param {Object} data
@return {Object|null}
@api private
Map google s custom dimensions & metrics with obj .