Use numeric custom metrics in Google Analytics on iOS
<p>I need to set a custom metric with a simple google analytics event.</p>

<p>I use the following method: to set the event, then set the custom metric, then send it all:</p>

<pre><code>GAIDictionaryBuilder.createEvent(withCategory: &lt;#T##String!#&gt;, action: &lt;#T##String!#&gt;, label: &lt;#T##String!#&gt;, value: &lt;#T##NSNumber!#&gt;).set(&lt;#T##value: String!##String!#&gt;, forKey: &lt;#T##String!#&gt;).build()
</code></pre>

<p>But I need to pass an INT in parameter of the value of the custom metric, not a STRING. My custom metric is a numeric value.</p>

<p>I don't understand why I don't find any "set" function with an INT in value.</p>

<p>In practice:</p>

<pre><code>let build = GAIDictionaryBuilder.createEvent(withCategory: "cat", action: "act", label: "lab", value: nil).set("100", forKey: GAIFields.customMetric(for: 1)).build() as [NSObject : AnyObject]
GAI.sharedInstance().defaultTracker.send(build)
</code></pre>

<p>Result:</p>

<pre><code>Saved hit: {
    parameters =     {
        "&amp;_crc" = 0;
        "&amp;_s" = 0;
        "&amp;_u" = ".nteoyAL";
        "&amp;_v" = "mi3.1.7";
        "&amp;a" = 114102722;
        "&amp;aid" = "com.dve.apptest";
        "&amp;an" = PrizeeTestGA;
        "&amp;av" = "1.0";
        "&amp;cid" = "28c24faa-f546-43e6-b596-e5a1c4e61373";
        "&amp;cm1" = 100;
        "&amp;dm" = "x86_64";
        "&amp;ds" = app;
        "&amp;ea" = act;
        "&amp;ec" = cat;
        "&amp;el" = lab;
        "&amp;ev" = "&lt;null&gt;";
        "&amp;sr" = 750x1334;
        "&amp;t" = event;
        "&amp;tid" = "UA-108352-26";
        "&amp;ul" = "en-us";
        "&amp;v" = 1;
        "&amp;z" = 17487374570739913012;
        gaiVersion = "3.17";
    };
    timestamp = "2016-10-14 10:02:38 +0000";
</code></pre>

<p>}</p>

<p>where "&amp;cm1" = 100 as STRING...</p>