title: How do I implement Campaign tracking with Cordova?
body: <p>I am trying to implement campaign tracking in my cordova app, but I am not having success.</p>
  
  <p>I previously used danwilson plugin, which works nice, but it does not have support for campaigns, as I saw here: </p>
  
  <p><a href="https://github.com/danwilson/google-analytics-plugin/issues/68" rel="nofollow">https://github.com/danwilson/google-analytics-plugin/issues/68</a></p>
  
  <p>So I changed my plugin to this fork:</p>
  
  <p><a href="https://github.com/Anu2g/google-analytics-plugin" rel="nofollow">https://github.com/Anu2g/google-analytics-plugin</a></p>
  
  <p>Which have campaign tracking.</p>
  
  <p>I am currently testing in Android, I have added this to my manifest</p>
  
  <pre><code>    &lt;!-- Used for Google Play Store Campaign Measurement--&gt;
  &lt;service android:name="com.google.android.gms.analytics.CampaignTrackingService" /&gt;
  &lt;receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
            android:exported="true"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="com.android.vending.INSTALL_REFERRER" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>As is shown in </p>
  
  <p><a href="https://developers.google.com/analytics/devguides/collection/android/v4/campaigns" rel="nofollow">https://developers.google.com/analytics/devguides/collection/android/v4/campaigns</a></p>
  
  <p>And I have the campaign function in my UniversalAnalyticsPlugin.java</p>
  
  <pre><code>private void trackView(String screenname, String deepLinkUrl, CallbackContext callbackContext) {
      if (! trackerStarted ) {
          callbackContext.error("Tracker not started");
          return;
      }
  
      addCustomDimensionsToTracker(tracker);
  
      if (null != screenname &amp;&amp; screenname.length() &gt; 0) {
          tracker.setScreenName(screenname);
          tracker.send(new HitBuilders
                  .ScreenViewBuilder()
                  .setCampaignParamsFromUrl(deepLinkUrl)
                  .build()
                  );
          callbackContext.success("Track Screen: " + screenname);
      } else {
          callbackContext.error("Expected one non-empty string argument.");
      }
  }
  </code></pre>
  
  <p>I try to make it work using the Google guide for testing:</p>
  
  <p><a href="https://developers.google.com/analytics/solutions/testing-play-campaigns" rel="nofollow">https://developers.google.com/analytics/solutions/testing-play-campaigns</a></p>
  
  <p>I launch </p>
  
  <pre><code>adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.my.app/com.google.android.gms.analytics.CampaignTrackingReceiver --es "referrer" "utm_source%3DtestSource%26utm_medium%3DtestMedium%26utm_term%3DtestTerm%26utm_content%3DtestContent%26utm_campaign%3DtestCampaign"
  </code></pre>
  
  <p>In my cmd, and it returns</p>
  
  <pre><code>    Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER cmp=com.my.app/com.google.android.gms.analytics.CampaignTrackingReceiver (has extras) }
  Broadcast completed: result=0
  </code></pre>
  
  <p>Which looks to work fine. Then I open my logcat, I open the compiled app, and it logs <code>Thread[GAThread,5,main]: No campaign data found.</code></p>
  
  <p>As I see in the plugin docs, I have to do this:</p>
  
  <pre><code>To track a Screen (PageView) w/ campaign detilas:
  
  window.analytics.trackView('Screen Title', 'my-scheme://content/1111?utm_source=google&amp;utm_campaign=my-campaign')
  </code></pre>
  
  <p>But I dont understand how do I receive the real URL with the params, not a hardcoded one.</p>
  
  <p>Someone who successfully have implemented Campaign tracking in Cordova can enlighten me?</p>
  
  <p>Thanks in advance</p>