How do I set appVersion for Google Analytics Event tracking
<p>When I try to set the <a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#appVersion" rel="noreferrer" title="appVersion">appVersion</a> in google analytics, then my event tracking stops working.  Specifically, I'm trying to include the app version with event tracking so I can know which version of the app caused an event.</p>

<p>I've tried setting the app version like this: </p>

<pre><code>ga('set', 'appVersion', app.version);
</code></pre>

<p>I've tried like this: </p>

<pre><code>ga('send', 
   'event', 
   eventCategory, 
   eventAction, 
   {'page': pageName, 'appVersion' : app.version });
</code></pre>

<p>And I've also tried the alternative syntax:  </p>

<pre><code>ga('send', 
   {'hitType' : 'event',
    'eventCategory' : eventCategory,
    'eventAction' : eventAction,
    'page' : pageName,
    'appVersion' : app.version});
</code></pre>

<p>If I include appVersion, then event tracking stops working.  No events show in realtime and no show the next day in the Behavior/Events section.  The PageViews still work though.</p>

<p>As requested in the comments, I am editing to add in my event tracking code.  It's been through several variations while I tried solve this problem.  Here's what it looks like currently.  </p>

<pre><code>var app = {
    trackEvent: function (pageName, eventCategory, eventAction, optionalEventLabel, optionalEventValue) {

        var eventObject = {
            'eventCategory' : eventCategory,
            'eventAction' : eventAction,
            'optionalEventLabel' : optionalEventLabel,
            'optionalEventValue' : optionalEventValue,
            'page' : pageName,
        };

        console.log("app.trackEvent - " + JSON.stringify(eventObject));

        ga('send', 'event', eventObject);
    }
}
</code></pre>

<p>I call this method from many places using a call like:</p>

<pre><code>app.trackEvent("PageNameValue", "EventCategoryValue", "EventActionValue", "EventLabelValueIfIHaveOne", AnIntegerValueIfIHaveOne);
</code></pre>

<p>Any help or suggestions will be greatly appreciated.</p>

<p><strong>Edit...</strong>
<em>I found the following bug report that seems to apply:  <a href="https://code.google.com/p/analytics-issues/issues/detail?id=366" rel="noreferrer">https://code.google.com/p/analytics-issues/issues/detail?id=366</a>
The bug reporter mentions solving this problem by setting up a custom dimension.  I will give that a try.</em></p>