Dynamic QR Codes
Dynamic QR Codes leverage Openscreen’s engine to generate trackable QR Codes whose intents, or targets can be changed at any time. Dynamic QR Codes return Scan Objects every time they are scanned, driving powerful insights into your QR Codes.
Create a Dynamic QR Code with an underlying Asset using the Real Estate Example in the Overview:
Requirements
A (free) Openscreen account
Locally installed Openscreen SDK
Authenticated with Openscreen SDK
An Openscreen Project
Create an Asset with a Dynamic QR Code
After you have created a project and obtained the projectId
, you are ready to initiate a QR Code solution.
Use the code below to create an Asset containing a Dynamic QR Code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//Obtain your projectId from the response of CreateProject call.
const { projectId } = projectRes.project;
async function main() {
// Create an asset and generate a Dynamic QR Code
const createAssetByProjectIdResponse = await os.project(projectId).assets().create({
name: 'My First Dynamic QR Code',
qrCodes: [{
intent: 'https://openscreen.com',
intentType: 'DYNAMIC_REDIRECT'
}]
});
const { qrCode } = createAssetByProjectIdResponse.asset.qrCodes;
// Returns a scannable QR Code and saves the png file in your project folder
await os.saveQrImageDataToFile(qrCode, "my-dynamic-qr-code.png");
// Returns the Openscreen qrCode object
console.log("QR Code:", JSON.stringify(qrCode, '',2));
}
main().catch(err => {
console.log(JSON.stringify(err, ' ', 2))
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Obtain your project_id from the response of CreateProject call.
project_id = project_res.project.project_id
#Create an Asset with a Dynamic QR code
res = ospro.project(project_id).assets().create({
"name": "My first Dyanmic QR Code",
"qr_codes": [{
"intent": "https://openscreen.com",
"intent_type": "DYNAMIC_REDIRECT"
}]
})
#Save the QR Code Image in png format in your working directory
ospro.save_qr_image_data_to_file(createAssetByProjectIdResponse.asset.qr_codes[0], "my-dynamic-qr-code.png")
Congratulations! You just created your first Openscreen dynamic QR Code!! 🥳 A new QR Code will appear as a PNG in your project directory. Find the QR Code and give it a scan.
Assets contain a unique identifier assetId.
This assetId
can be used to create further Openscreen resources. You can obtain this assetId from the response of the CreateAsset
endpoint used above:
1
const { assetId } = response.asset;
1
asset_id = response.asset.asset_id
What Happens When a Dynamic QR Code is Scanned?
Here, we find the power of Dynamic QR Codes. Each time a dynamic QR Code is scanned the following data is captured:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
"entityType": "app.scan",
"created": "2021-10-07T18:38:06.616Z",
"modified": "2021-10-07T18:38:06.616Z",
"assetId": "0a43a07c-0e57-4879-9420-332a13174458",
"scanId": "f3333e42-e864-44f1-b5c0-bde9c31952d7",
"projectId": "c166f2dd-9ea8-4a79-90d5-fa6989f885e6",
"qrCodeId": "2a1ffa66-9a3f-4ea3-ab40-35a93f392d57",
"ipAddress": "xx.xxx.xxx.xx",
"scanTime": "2021-10-07T18:38:05.557Z",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
"deviceType": "mobile",
"deviceModel": "iPhone",
"deviceVendor": "Apple",
"osName": "iOS",
"osVersion": "14.7.1",
"engineName": "WebKit",
"engineVersion": "605.1.15",
"browserName": "Mobile Safari",
"browserVersion": "14.1.2",
"locationPostalCode": "M6H",
"locationLatitude": "43.66530",
"locationLongitude": "-79.43430",
"locationCityName": "Toronto",
"locationRegionName": "Ontario",
"locationRegionCode": "ON",
"locationCountryName": "Canada",
"locationCountryCode": "CA",
"locationTimeZone": "America/Toronto",
"locationString": "Toronto, Ontario, Canada"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
"entity_type": "app.scan",
"created": "2021-10-07T18:38:06.616Z",
"modified": "2021-10-07T18:38:06.616Z",
"asset_id": "0a43a07c-0e57-4879-9420-332a13174458",
"scan_id": "f3333e42-e864-44f1-b5c0-bde9c31952d7",
"project_id": "c166f2dd-9ea8-4a79-90d5-fa6989f885e6",
"qrCode_id": "2a1ffa66-9a3f-4ea3-ab40-35a93f392d57",
"ip_address": "xx.xxx.xxx.xx",
"scan_time": "2021-10-07T18:38:05.557Z",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
"device_type": "mobile",
"device_model": "iPhone",
"device_vendor": "Apple",
"os_name": "iOS",
"os_version": "14.7.1",
"engine_name": "WebKit",
"engine_version": "605.1.15",
"browser_name": "Mobile Safari",
"browser_version": "14.1.2",
"location_postal_code": "M6H",
"location_latitude": "43.66530",
"location_longitude": "-79.43430",
"location_city_name": "Toronto",
"location_region_name": "Ontario",
"location_region_code": "ON",
"location_country_name": "Canada",
"location_country_code": "CA",
"location_time_zone": "America/Toronto",
"location_string": "Toronto, Ontario, Canada"
}
Collecting this data allows you to determine how many times your QR Code has been scanned, where scans are taking place and much more. This information is captured, analyzed, and made accessible using Openscreen reporting.