How to make deferred deep linking?

前端 未结 1 1709
轻奢々
轻奢々 2020-12-29 00:13

How to make deferred deep linking and generate unique mobile signature. I try using IP Address, screen-size, OS version, device name but still not get succeed.

相关标签:
1条回答
  • 2020-12-29 00:53

    The comment links to a great answer, certainly. High level, here are the steps:

    1. Your links should point to a page on your site that collects a digital fingerprint
    2. That page should collect, at minimum, IP address, OS, OS version and screen size (width and height). Should send to your server and place in a persistent store. Redis works great for this because of its fast lookup times. Also record some sort of unique identifier for which link was clicked (that could be the value in redis).
    3. Then redirect to the app (URI scheme) and have a fallback to the App Store/Play Store. Here's an example for iOS. The beauty of the iframe is that it kills the alertView if the app is not installed. This should be placed in the body:

          <script type="text/javascript">
              window.onload = function() {
                  // Deep link to your app goes here
                  document.getElementById("l").src = "my_app://";
      
                  setTimeout(function() {
                      // Link to the App Store should go here -- only fires if deep link fails                
                      window.location = "https://itunes.apple.com/us/app/my.app/id123456789?ls=1&mt=8";
                  }, 500);
              };
          </script>
          <iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
      
    4. When a user opens your app, send up the same combination of params to your servers and search your persistent store to see if this device recently clicked on a link. Send a response down to your app (e.g. { link_id: "1234" } or { link_id: -1 }) Your app logic should then respond based on which link was clicked.

    Hopefully this makes sense. We do this at Branch and can assure you that it's harder than it looks to roll this solution from scratch. There are a ton of edge cases introduced by individual browsers and even individual apps (e.g. when links are shared to Twitter and clicked on in the native Android app). But at it's core fingerprinting is relatively simple. Hopefully the above was helpful.

    0 讨论(0)
提交回复
热议问题