My use case is the following: For an event, I want to sent an email with a QR Code to the contacts who registered for the event. I will use a single-send-journey.

All contacts data are stored in a Data Extension. My subscriber key is the contact ID from SalesCloud.

When the QR code is scanned, the following should happen: One column in my data extension should be updated with a new value (Column: EventTracking, Value = Attended)

I think I need to add a code to my Ampscript, but which one?

I managed to create the QR code that shows the Subscriber Key when I scan it.

And I managed to update the Column, but directly when I sent the email (I used: @upsertDE). So both work independently from each other ;-)

Any Idea what I need to do, to update the Data Extension only when the QR code is scanned?

  • It would be possible to know that someone scanned the QR only if the QR would lead to a CloudPage. Then from the CloudPage you could insert a record into your DE
    – zuzannamj
    Commented Feb 21, 2023 at 10:45
  • Thank you, so I need to create a cloudpage and add the cloudpage URL to my QR code - is that correct? Ideally, I want to update an existing record in my DE (a specific column), I do not want to add a record into the DE. Is that also possible? Commented Feb 21, 2023 at 13:35
  • @TrialandError yes if you go for that route. If you want to upsert/update a record in your DE, then the DE need to have a primary column. For example can use the subscriber key column as the primary column
    – Duc Le
    Commented Feb 21, 2023 at 13:47
  • Request to go through this article by @zuzannamj... it would make your implementation more of ease ... generating-barcodes-and-qr-codes-in-salesforce-marketing-cloud Commented Feb 21, 2023 at 14:15
  • Thank you so much. I am already struggling with the cloudpage. I created a landing page and here I want to display the subscriber key. When I scan the QR code, then I am redirected to the cloud page, but the subscriber key (that is included inthe QR code) is not shown... what must I add to the cloudpage to get the subscriber key displayed? Commented Feb 21, 2023 at 21:21

2 Answers 2


It is impossible to know if a person scanned the QR code in an email. QR code actually is an encoded image that a scan app can use to extract the information (e.g. an URL)

Update: to make it more clear

They cannot interact with QR code to update/upsert to your DE when:

  • The extracted information from the QR code is just simply a text
  • The extracted information from the QR code is not a Coudpage URL where you can use it as a handler page
  • The person only scan the QR code without going to the URL (is a Cloudpage)

So from the scan app, it only can extract the information of the encoded text without the MC environment to do update/upsert to your DE.

They can interact with QR code when:

  1. The QR code was encoded with Cloudpage URL and its parameters
  2. The person scan the QR code and then go to that URL result
  3. The Cloudpage get parameters to update/upsert to your DE
  • Thank you so much @Duc Le. I created a Cloudpage URL and added this to my code. When the code is scanned, the Cloudpage opens, but as you wrote.. when I scan the app, I get the URL and then I actively need to click on the URL. Is it possible to be directed directly to the URL when I scan the code? Commented Feb 22, 2023 at 9:04
  • @TrialandError I don't think you can do anything about it, going to the Link or not is their decision :) IMHO just put both the Cloudpage link and the QR code or just the Cloudpage link in the email, and if they want to attend to your event then they can click directly to the link
    – Duc Le
    Commented Feb 22, 2023 at 9:15
  • In my case, it is not the contact who will scan the code. It is the event team who will scan the code ... then a field in the data extension should be updated, so that we know that this contact has attended the event. Also: Is there any option that the code can only be scanned once, and afterwards it will be invalid/there will be an error message? (to avoid, that a contact passes the mobile phone to another person after he/she checked in at the event... and the other person checks in with the same code). Commented Feb 22, 2023 at 9:27
  • @TrialandError sorry I don't see any options to do like what you mention
    – Duc Le
    Commented Feb 22, 2023 at 9:43
  • hm ok, thank you. Maybe then the MarketingCloud is not the correct tool ... Commented Feb 22, 2023 at 9:47

Quick thought here. If you use an Encoded CloudPage URL you can set up the page to look for a generated unique code in an Attribute in the target DE. You can either use the GUID() function or build your own using AMPscript and an alphanumerical string.

Once you have that built, you can append it in the CloudPageURL as part of an attribute pair. You then use RequestParameter() to extract it from the URL after scanning. When the Event Team scans the code you can then set up AMPscript on the page to check the Target DE, and log a a value of "TRUE" or "1" in a "Scanned" attribute, if the code had not previously been scanned. This can be nested inside an IF/ELSEIF, where the first IF looks up the unique code in the URL and checks if it has a Scanned value of "TRUE". If it does, then the CloudPage can load an error message saying this code has already been scanned and not log anything back to the DE.

This build should achieve all of your requirements as I understand them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .