title: Android Install referral tracking uniqueness
body: <p>I implemented install referral tracking in my app from:
  <a href="https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-campaigns" rel="nofollow">https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-campaigns</a></p>
  
  <p>my referral receiver:</p>
  
  <pre><code>    public class ReferrerReceiver extends BroadcastReceiver
  {
      private static final ObservableChanged _observable = new ObservableChanged();
  
      //--------------------------------------------------------------------------
      public static Observable getObservable()
      {
          return _observable;
      }
  
      //--------------------------------------------------------------------------
      public static String getReferrer(Context context)
      {
          // Return any persisted referrer value or null if we don't have a referrer.
          return context.getSharedPreferences("referrer", Context.MODE_PRIVATE).getString("referrer", null);
      }
  
      //--------------------------------------------------------------------------
      public ReferrerReceiver()
      {
          Logger.log(null, "ReferrerReceiver.ReferrerReceiver()");
      }
  
      //--------------------------------------------------------------------------
      @Override public void onReceive(Context context, Intent intent)
      {
          Logger.log(context, "ReferrerReceiver.onReceive(Context, Intent)", intent);
  
          try
          {
              // Make sure this is the intent we expect - it always should be.
              if ((null != intent) &amp;&amp; (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")))
              {
                  // This intent should have a referrer string attached to it.
                  String rawReferrer = intent.getStringExtra("referrer");
                  if (null != rawReferrer)
                  {
                      // The string is usually URL Encoded, so we need to decode it.
                      String referrer = URLDecoder.decode(rawReferrer, "UTF-8");
  
                      // Log the referrer string.
                      Logger.log(context,
                          "ReferrerReceiver.onReceive(Context, Intent)" +
                          "\nRaw referrer: " + rawReferrer +
                          "\nReferrer: " + referrer);
  
                      // Persist the referrer string.
                      context.getSharedPreferences("referrer", Context.MODE_PRIVATE).
                          edit().putString("referrer", referrer).commit();
  
                      // Let any listeners know about the change.
                      _observable.notifyObservers(referrer);
                  }
              }
          }
          catch (Exception e)
          {
              Logger.log(context, e.toString());
          }
      }
  
      //**************************************************************************
      protected static class ObservableChanged extends Observable
      {
          //----------------------------------------------------------------------
          @Override public boolean hasChanged()
          {
              return true;
          }
      }
  }
  </code></pre>
  
  <p>but referrer attribute is getting broadcasted by the Play Store to my app after every repeated install(uninstall and install on same device).</p>
  
  <p>for a quick test install this app from play store(not mine) from this link:
  <a href="https://play.google.com/store/apps/details?id=fr.simon.marquis.installreferrer&amp;referrer=myReferrerValue" rel="nofollow">https://play.google.com/store/apps/details?id=fr.simon.marquis.installreferrer&amp;referrer=myReferrerValue</a></p>
  
  <p>you will get referral value = "myReferrerValue" on every first launch of repeated install(uninstall and install on same device).</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Does the play store send referral broadcast even when app are installed on the same device repeated times?</p></li>
  <li><p>Shouldn't referrers only be broadcasted once per device?</p></li>
  </ol>