Overview
Dynamic Links and Deep Links
Imagine you're playing with toy cars and you have a toy garage with different levels. Dynamic links and deep links are a bit like special roads that lead to different places.
Dynamic Links:
Think of a dynamic link as a magical road sign. When you show this sign to your friends, it can change where it leads based on who is looking at it and where they are. So if your friend is near the blue car garage, the dynamic link takes them there. If they're near the red car garage, it takes them there instead. It's like a road that adjusts its path depending on where you are.
Deep Links:
Now, think of a deep link as a specific road that goes straight to a particular place in the garage. For instance, if you want to show your friends the cool race track on the top level of the garage, you can give them a deep link that leads right to that spot. It's like having a shortcut directly to the place you want to show.
In simple words:
Dynamic links are like signs that can change where they take you based on where you are.
Deep links are like secret shortcuts that take you directly to a specific place you want to go.
Dynamic links: Depending on where the request is coming from; the result changes. if a user is coming from a desktop or mobile, if the user has an app installed or not, etc.
Deep links: Deep link does not change its result, it does not change depending on desktop or mobile. If you’ve used Deeplink somewhere on the website user will be redirected to the app with that Deeplink. let's say you created a deep link for the category that looks something like toolstation://deeplink-categry/c100. Now when the user clicks on this; it will try to open the app (without checking anything if a user has an app or not if a user is using mobile or not) and the app will route the user depending on para, in this case, deeplink-categry/c100, so the app will redirect the user to that category within the app.
Flow
Given: The link is, https://example.com/search?q=searchquery
- X user sends this link to Y user
- Y user clicks on the link
- So the link is opened in the browser
- On the front end side devs wrote code to check if the device is mobile (Android/ iOS), or Anything else.
- If the device is mobile; redirect the user to the dynamic link - which is responsible for the opening app (if installed) or redirect the user to a fallback action (e.g. Playstore or show web content (where the dev has eliminated the possibility of infinite loop occurring between original URL and dynamic link))
- If the device is not mobile simply show the content and no redirection.
- When the app is opened from step 5 few parameters are passed and the app will check what paras are there and depending on that app redirects the user.
- Advanced concepts: Dynamic link is made up of a few basic things + deep link; so in step 5 when the dynamic link opens the app it passes the whole dynamic link to the app; and from that app extracts the deep link and does the process. Also for step 3, it is possible that the OS you are using process the link and see if the result is some kind of redirection to the app then this step is skipped.
Explain to me in non techy way:
You have a special link like a secret code that takes you to a website. This link looks like this: https://example.com/search?q=searchquery.
- Imagine you have a secret code card, and you give it to your friend. This code card is like the link. You're X and your friend is Y.
- Your friend takes the code card you gave and looks at it. It's like they're using the link.
- When your friend looks at the code card, it's like they opened a magical door on their computer or phone. This door leads to a special website.
- The people who made the special website added a clever trick. They made the website look at the user’s device (from which they are accessing the link) and see if it's a mobile phone (like a phone that can go everywhere) or something else like a regular computer.
- If your friend's using a mobile phone, the website is even smarter! It knows how to send your friend to another secret door that's inside an app on their phone. This app is like a special game.
- If the game is already installed, the secret door takes your friend inside the game.
- If the game isn't installed, the website helps your friend find and install the game.
- But the people who made this don't want any confusion. They made sure that your friend wouldn't get stuck going back and forth between doors. They fixed this so it's easy for your friend.
- If your friend is using a regular computer, the magical website just shows them the cool stuff on the website. There's no need to open any doors.
- If your friend gets into the game (by some redirection from the website), there are some secret notes your friend brings with them from the website. These notes tell the game what to do next. It's like a treasure map for the game to follow.
Developing our own logic?
What if the website doesn't use services like Firebase dynamic links which means does the website have to develop some logic to check if the app is installed or not, if yes is that even possible to develop that logic? If it's possible then can we trigger deep links directly from there which opens the app?
Yes, correct. It is possible but it will be a little bit of overhead.
Checking if an App is Installed
The website's code can use JavaScript to detect whether a specific app is installed on the user's device. This can be done by trying to trigger the app's custom URL scheme. An app usually registers a unique URL scheme that can be used to open the app directly.
Using Deep Links
If the app is detected to be installed, the website's code can create a link (deep link) that uses the app's custom URL scheme. When the user clicks on this link, it triggers the app to open if it's installed.
Fallback Mechanism
If the app is not detected to be installed, the website's code can provide a fallback action. This can be opening the app store page for the app or directing the user to a relevant web page with similar content.
While it's possible to develop this logic, there are some considerations
- Cross-Platform Compatibility: Custom URL schemes might work differently on different platforms (iOS, Android, etc.), and handling these differences can be complex.
- Security: Custom URL schemes can be potentially misused by malicious actors. It's important to ensure that the deep link mechanism is secure and doesn't compromise user safety.
- App Updates: If the app's custom URL scheme changes in the future due to updates, the website's logic might need to be updated accordingly.
- Code Complexity: Implementing this logic requires coding knowledge, and handling all possible scenarios (different devices, app installed/not installed, etc.) can lead to complex code.
Services like Firebase Dynamic Links offer a more streamlined and user-friendly way to handle dynamic linking, as they abstract much of the complexity and provide a unified solution across platforms. However, for developers who want more control or are not using Firebase, developing their own deep linking logic is indeed possible, but it can require careful planning and thorough testing.
- Extra support links: