Making links on your domain open in the app
If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.
- Product Updates
- Pugpig Bolt
- Pugpig Site
- Third Party Integrations
- Legacy Products
- Pugpig Consulting
Table of Contents
For the majority of our clients, if they want to share deep links to the apps they’ll use the app domain. However, in some cases you might wish to have the same URLs that are used for your website, to open the app when users have it installed.
For example, if you want to share https://www.vanity.com/mystory and you want this to open in the app in the correct place, there is some work to be done:
- NOTE: This is a Pugpig Bolt only feature - deep linking into a story in a Publish Edition forces the entire edition to download so doesn't make much sense.
Step 1: Plan which URLs you want to open in the app
Before diving in, you need to decide which URLs should open in the app. Often it will just be article pages. Any pages that are not mapping to a URL in the app will open in the app in an embedded web view. Ideally your URL structure will make this easy to determine, for example if all articles start with /story/
For the article URLs, you need to ensure there is a mapping between the URLs on your site and the URLs in the app. The Pugpig team can help change the Pugpig URLs if the format does not include your unique article ID.
Step 2: Associate relevant URLs on your domain with the app
You’ll need an app association file on your server that tells the operating system which URLs on your domain to open in the app (for example, if all the stories are under /story/ you can target that). You may also want to include the home page or section pages if you'd prefer these to open in the app. This involved creating files on your server from both iOS and Android:
- iOS Documentation: (apple-app-site-association) - https://developer.apple.com/documentation/xcode/supporting-associated-domains - we will give you the App ID if you do not know it.
Android Documentation (assetlinks.json): https://developer.android.com/training/app-links/verify-site-associations#web-assoc - we will give you the fingerprint of the app if you do not know it
Android also has manifest.json which you should create, although it is not strictly needed for the deep linking.
Note: On both Android and iOS, the list of domains need to be included in the app bundle at submission time. On Android, the URLs are also embedded in the app, so any change to this will require a new app update. On iOS, the site association file gives the specific URLs, so app releases aren't needed.
Step 3: Provide the redirection service
You will need to provide a redirection service that will redirect from your domain to the pugpig domain and URL If the user agent contains Pugpig. For example:
https://www.vanity.com/mystory -> https://app.vanity.com/mystory/content.html
NOTE: If your redirecting service requires redirects to be cached, you should NEVER Vary-By user agent. We provide a separate header x-pugpig-bolt-reader with value true that you can use. It is preferable to use this over user-agent.
See here for more information on how to choose the URL structure for your content
When this is in place, the app will open when a user hits https://www.vanity.com/mystory and then follow the redirect that makes sure the user ends up in the right place.
>>> curl -I -H 'x-pugpig-bolt-reader: true' https://www.vanity.com/story/123456/ HTTP/2 302 Location: https://app.vanity.com/story/123456/content.html
Step 4: Test the redirection service
Test this end to end by clicking on many different deep links!
On iOS, the App Smart Banner, which usually directs users to the store to install your app, will behave differently if the app is installed and the web page the users is on has a valid deep link into the app.
In this case the smart banner will display an “Open” CTA, tapping which deep link you directly into the page.