Generate a promotion QR code

Generate a promotion QR code to direct users to a specific page in your mini program. This is ideal for campaign landing pages, product details, coupons, and other scenarios where you need to guide users to a target page.

Before you begin

Before you begin, ensure you meet the following requirements:

  • Role: You must have either of the following roles:
    • Workspace Owner or Master
    • Admin for the target mini program
  • Version status: The mini program must have a version in the Full Release status.

Procedure

To generate a promotion QR code, take the following steps:

  1. In your workspace, navigate to the mini program list page.
  2. Find and click the mini program for which you need to generate a promotion QR code.
  3. On the mini program details page, click the QR Code tab.
  4. On the Promotion QR Code tab, click +Generate QR Code.
  5. In the dialog that appears, configure the following fields to customize your code:
    • (Optional) URL Parameter: Enter the path of the mini program page that the QR code opens. Use a path defined in app.json.pages. If you leave this field empty, the QR code opens your mini program homepage.
    • (Optional) Query Parameter: Enter the key-value pairs that are passed to the target page. You can retrieve these parameters from the query property of the options object in App.onLaunch when the mini program is opened for the first time, or in App.onShow when it is reopened from the background. If you leave this field empty, the QR code opens the specified page without additional query parameters.
    • Description: Enter an internal description (2 and 20 characters) to help you identify the QR code in the list.
  1. Review the information you entered.
  2. Click Generate.

A success message appears, and you are redirected to the promotion QR code list where your new code is displayed.

Next steps

After generating the QR code, you can test it and then download it for use:

  1. (Optional) Test the QR code

It is recommended to test it to ensure it opens the correct page. To test the code:

    1. Hover over the QR code thumbnail to see an enlarged view.
    2. Scan the code using a target app in which the mini program is fully released.
    3. Verify that the app opens the correct target page.
  1. Download and distribute the QR code
    1. Click Shape.png (the download button) next to the QR code to save the image file.
    2. Distribute the downloaded code as needed. For example, add it to your campaign materials, product pages, or other promotional channels.