# QR codes that open your app (and fall back to the store)

> How to make one QR code that opens your app on the right screen when it's installed, sends everyone else to Google Play or the App Store, and keeps the screen for after install. What to put in the code, how to print it, how to tag scans, and how to test.

Source: https://straitlink.in/blog/qr-code-to-open-app-store-fallback/

A QR code on a menu, a parcel, a receipt or a shop poster should do one thing: put the person on the right screen of your app. A code that points at a website, or at one store, can't do that: Android users scanning an App Store code (or the reverse) hit a dead end.

The fix is not a special kind of QR code. A QR code is only a link. What happens after the scan depends entirely on which link it holds and on what answers that link. This post covers what to encode, what happens on each phone, how to print the code so it scans, and how to see which codes are working.

## What to put in the QR code

| The code holds | App installed | No app, Android | No app, iPhone | Desktop |
|---|---|---|---|---|
| Your website | Website | Website | Website | Website |
| A Google Play link | Play listing | Play listing | Dead end | Play in a browser |
| An App Store link | App Store page (iPhone), dead end (Android) | Dead end | App Store | App Store in a browser |
| A deep link on your link domain | **The screen** | Play, then **the screen** | App Store page, then the screen (opt-in) | Website |

Only the last row serves everyone. It is an ordinary `https://` link on a domain verified for your app, such as `https://hilltop.strait.link/table-12`, answered by a server that decides per phone.

There is a second reason to print a link you control: you can change where it points later. Packaging lasts for years; your store listing, your web pages and even your app can change in the meantime. With Strait you change a link's destination with one API call (`PATCH /v1/links/{slug}`) or in the dashboard, and every code already printed follows it ([Short links](https://straitlink.in/docs/short-links/#link-controls)).

## What happens after the scan

<figure class="blog-figure">
_Diagram: What one QR code does on each device. A scan opens the link. On Android the link server hands it to the app, or to Google Play with the link kept. On iPhone the app opens through Universal Links, or a Get the app page leads to the App Store. On a computer the website opens._
<figcaption>One code, three outcomes. The decision is made when the link is opened, not when the code is printed.</figcaption>
</figure>

The camera or scanner app opens the link. From there, it's the same as any other tap:

- **Android, app installed.** If the scanner hands the link to the system and your domain is verified, Android opens your app directly. If the link loads in a browser first, Strait answers with an `intent://` hand-off that opens your app on the link's path.
- **Android, no app.** The same hand-off falls back to Google Play, with the link and the scan attached in the install referrer. After install, the first open lands on the link's screen. This is the deferred deep link path, which we tested on a real phone with a Google Play internal testing build ([deferred deep linking explained](https://straitlink.in/blog/deferred-deep-linking-explained/)).
- **iPhone.** If the app is installed, Universal Links open it. If not, Safari shows a page with your app's name and a **Get the app** button for the App Store, and the first open after install can land on the screen. That install match is opt-in (off until you turn it on).
- **Computer.** Someone scanning a code on a screen with a laptop webcam, or opening the link on a desktop, goes to the link's desktop URL or its destination.

Scanner apps differ in whether they open links in the default browser, an in-app view or directly through the system. That's the main reason to test on the phones your customers carry rather than assume.

## Printing a QR code that scans

The QR code standard has a few rules worth knowing before a print run. Denso Wave, the inventor of the QR code, documents them:

- **Keep the quiet zone.** "QR Code requires a four-module wide margin at all sides of a symbol" ([Denso Wave: QR code size](https://www.qrcode.com/en/howto/code.html)). Designers often crop it. Don't.
- **Pick an error correction level.** Level L restores about 7% of the code, M 15%, Q 25% and H 30%. M is the one most often chosen. Higher levels survive more damage but make the code denser ([Denso Wave: Error correction](https://www.qrcode.com/en/about/error_correction.html)).
- **Short links make simpler codes.** Fewer characters mean fewer modules, so the code scans from further away at the same printed size. `https://hilltop.strait.link/t12` encodes into a smaller code than a full product URL with tracking tags.
- **Print vector.** An SVG stays sharp at any size; a screenshot of a PNG doesn't.

If you generate codes yourself, the `qrcode` package for Node does all of this:

```js
import QRCode from 'qrcode';

const url = 'https://hilltop.strait.link/table-12';
await QRCode.toFile('table-12.svg', url, {
  type: 'svg',
  errorCorrectionLevel: 'M',
  margin: 4, // the four-module quiet zone
});
```

Our free [app QR code generator](https://straitlink.in/tools/qr/) does the same in the browser: paste a link, download SVG or PNG, with the quiet zone and error correction set for print. In the Strait dashboard, every link also has a QR code download.

## One code per placement, tagged

A code on table 12 and a code on the takeaway bag are different channels. If they share one link, you can't tell them apart. Two habits help:

1. **One link per placement.** Create `/table-12`, `/bag-oct`, `/poster-mg-road`. Each has its own taps and installs.
2. **Tag the destination.** Put `utm_source=qr` and `utm_medium=print` on the destination, plus `utm_campaign` for the offer and `utm_content` for the placement. Strait reads `utm_source` and `utm_campaign` from the destination, so scans show up next to WhatsApp and email in your reports, through the install on Android ([REST API reference](https://straitlink.in/docs/api/)).

Creating a link is one request:

```bash
curl https://strait.link/v1/links \
  -H "Authorization: Bearer $SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "slug": "table-12",
        "longUrl": "https://shop.example.com/menu?utm_source=qr&utm_medium=print&utm_campaign=menu-oct&utm_content=table-12" }'
```

For hundreds of placements, `POST /v1/links/batch` takes up to 500 links per call. The [UTM builder](https://straitlink.in/tools/utm-builder/) keeps tag names consistent.

## When a printed code outlives the offer

Printed codes stay in the world after the campaign ends. Rather than let the link die, decide what an old scan should do. With Strait, a link can expire at a set time, and you choose what happens next: an "expired" page, the app store for the phone, or a web page you pick. Expired scans are still recorded, never billed ([When a link expires](https://straitlink.in/docs/short-links/#when-a-link-expires)).

If you are replacing codes that pointed at Firebase Dynamic Links, Google stopped opening apps from those `page.link` links when the service shut down on 25 August 2025 ([Firebase: Dynamic Links FAQ](https://firebase.google.com/support/dynamic-links-faq)). Some now return 404; others still do a plain redirect to their old fallback, which Google could stop at any time. The [page.link checker](https://straitlink.in/tools/page-link-checker/) shows where each of yours pointed.

## Testing before the print run

- [ ] App Links verified for the link domain ([App Links checker](https://straitlink.in/tools/app-links-checker/))
- [ ] Scanned with the default camera on an Android phone and an iPhone
- [ ] Scanned with the app installed and with it uninstalled
- [ ] A printed proof scanned at the real size, in the light where it will hang
- [ ] Scan shows up in Analytics with channel `qr` and the right campaign

## Sources and how we checked

- Denso Wave, [QR code size and margin](https://www.qrcode.com/en/howto/code.html) and [Error correction feature](https://www.qrcode.com/en/about/error_correction.html): the quiet zone and the L/M/Q/H levels.
- Firebase, [Dynamic Links FAQ](https://firebase.google.com/support/dynamic-links-faq): the shutdown date.
- The per-device decisions, the Play referrer, the channel and campaign rules and the expiry options are from Strait's link engine code and its [short links](https://straitlink.in/docs/short-links/) and [API](https://straitlink.in/docs/api/) docs. The Android deferred path is from our real-phone test with a Google Play internal testing build (October 2026).
- The `qrcode` options are from the package's documentation on npm.
