---
title: QR Code & PURL Trackers | PostGrid
description: Overview of PostGrid Trackers — embed personalized QR codes and URLs in mail orders to monitor recipient interactions and visit data.
---
Trackers allow you to track user interactions in your orders with the use of personalized URLs and QR codes
Tracking user interactions is simple by integrating Trackers into your orders. Trackers can be incorporated into orders in the form of QR codes or personalized URLs (PURL) to monitor interactions. Information such as unique and total visit count, the interacting device, IP address and associated order can be found on visits to a Tracker.
The Tracker integration flow is composed of the following steps:
1. Create a Tracker with a `redirectURLTemplate` and a `urlExpireAfterDays`
2. Include The Tracker in a template using the Tracker id. eg.: `{{tracker_abcdefgh}}` or `{{tracker_abcdefgh.qrcode}}`
3. Send mail using that template (no need to pass the trackers as merge variables here)
4. Get notified when a recipient scans the generated QR code or access the PURL related to that specific mail
It is important to note a few things about the Tracker behavior:
- One Tracker may be used to generate unique QR codes and PURLs per mail. Therefore, if you were to send a batch of letters using a template with the same Tracker id, the QR code/PURL generated would be unique per letter.
- The QR codes and PURLS are unique per mail. However, the redirect URL Template is the same, meaning the domain name that the user gets redirected to is the same for all recipients, with the exception of paths and parameters that can be personalized. eg.: `https://postgrid.com?name={{to.firstName}}`
- The `urlExpireAfterDays` parameter refers to the number of days each QR code and PURL will be active for after being generated upon mail creation. If the `urlExpireAfterDays` for a Tracker were set to 30 days, and you create one letter with a QR code today, then that QR code will expire 30 days after today. Though if you were to create another letter with a QR code tomorrow, then that other QR code will expire 30 days from tomorrow.
## 1. Create a Tracker
The main two parts of a Tracker are:
- The redirect URL template, that will take the user to desired site.
- The number of days for the PURL or QR code to expire after it had been generated
## Redirect URL Template
When creating a Tracker, a `redirectURLTemplate` must be specified. This URL template serves as the URL which the Trackers will redirect the recipient to. If we wanted to redirect to the [PostGrid website](https://postgrid.com), a `redirectURLTemplate` of `https://postgrid.com` must be specified. This is great if you need to redirect to a general page but, if further personalization is required, merge variables can be added to customize the URL’s paths or parameters.
Any valid merge variables which are in the `redirectURLTemplate` will be filled in during the generation of the PURL. This means that you can personalize URLs based on each order. The table below showcases a couple of different examples of merge variables in a `redirectURLTemplate` and the resulting URL.
| URL Template | Resulting URL |
| :--------------------------------------------------------------------------------------- | :---------------------------------------------------- |
| `https://postgrid.com?name={{to.firstName}}` | `https://postgrid.com?name=Calvin` |
| `https://postgrid.com?id={{to.metadata.id}}&favoriteDance={{to.metadata.favoriteDance}}` | `https://postgrid.com?id=abc123&favoriteDance=ballet` |
Any merge variables which are accessible in an order will also be accessible in the PURL for the Tracker when generating the order. This will allow you to access custom information for a more personalized customer experience.
Note: the redirect URL is limited by its domain, it is not possible to customize domains, only URL paths and parameters as illustrated above.
For more details on how to create a Tracker, check out our [API documentation](https://docs.postgrid.com/#ec4f1454-77a8-43e3-82d5-4a07dc9e33a8) or our [dashboard tracker guide](/print-and-mail/dashboard/trackers-adding-qr-code-and-purls-to-your-mailings/index.md).
## 2. Including Trackers in Templates
To generate a **PURL** , a Tracker id must be included in a template as if it was a merge variable :
`{{tracker_abcdefghijklmnopqrstuvwxyz}}`
To generate a **QR code**, a Tracker id with the addition of a `.qrcode` must be included as if it was a merge variable in an image source link:
``
The image below presents and example of including a QR code and a PURL in a Template using our dashboard template tool:

Another example of including both in a HTML template can be seen below:
```
Visit our website at {{tracker_abcdefghijklmnopqrstuvwxyz}}
Don't feel like typing out the URL? Scan the QR code below!