I am trying to teach myself how to create calculated metrics using the 1.4 api because I have to create 300 metrics, and I would prefer not to do this manually. I have read the Github documentation here. The challenge I am having is adding a segment that applies to all metrics within a container. There is a comment in the documentation that reads:
"calculatedMetric": this is a wrapper around any piece of the calculated metric definition. The only reason to use this wrapper is to apply "segments" to all pieces inside the wrapper.
The problem is that there are no examples showing the syntax for how this works. In my attempt, I was successful at creating a metric, however a segment was not applied. See below for my json.
Can someone take a look and see where my error is? I find it strange that an actual metric was created but no segment existed. I would have thought I would have received an error.
Separate question - when I use "type": percent, I still get a metric is a decimal. Anyone know why that is?
I used the API once and the best way to get the solution to see examples is to create the segment that you desire in the interface, grab its ID (at the end of the URL when you edit the Calculated metric, will start by cm) and do the api call to see its definition.