Properly tracking install referrals on Play Store

后端 未结 3 1578
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 05:59

I have a simple task: I want to track the referral id of an app install and pass it to backend.

What I did: I created a link with an extra parameter referrer

3条回答
  •  伪装坚强ぢ
    2021-02-04 06:34

    I have used utm tagging

    you can see full source at https://github.com/dheeraj9198/Utm-Test

    I am providing the basic code

    public class CustomCampaignTrackingReceiver extends BroadcastReceiver {
        private static final String TAG = CustomCampaignTrackingReceiver.class.getSimpleName();
        private static final Logger LOGGER = LoggerFactory.getLogger(TAG);
        private static final Marker MARKER = MarkerFactory.getMarker(TAG);
    
    
        @Override
        public void onReceive(Context context,final Intent intentx) {
            LOGGER.info(MARKER, "on Receive called");
            ExecutorService executorService = Executors.newSingleThreadExecutor();
            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        for (String key : intentx.getExtras().keySet()) {
                            try {
                                LOGGER.info(MARKER, key + " => " + String.valueOf(intentx.getExtras().get(key)));
                            } catch (Exception e) {
                                LOGGER.error(MARKER, "caught exception in on key retrieval ", e);
                            }
                        }
                    } catch (Exception e) {
                        LOGGER.error(MARKER, "caught exception in key loop ", e);
                    }
                }
            });
            executorService.shutdown();
        }
    }
    

    --------------------------Manifest---------------------------------------

            
                
                    
                
            
    
            
                
                    
                
            
    

提交回复
热议问题