Replace Gmetric implementation

I didn't like gmetric.js's quality and I thought it might gain something by way
of concision if it were re-written. I did so (and tested) and it works.

Change-Id: I0c3198d122511aa856906e9bd7b8233a4dbda332
Merge "Replace Gmetric implementation" into production