There are three main ways to open a mini program: scanning QR code, forwarding and sharing, and jumping.

  • Scanning: ordinary link QR code, mini program code, mini program QR code.
  • Forwarding and sharing: including forwarding to groups, forwarding to individuals, etc.
  • Link jumping: can wake up WeChat Mini Program from outside WeChat.

Application scenarios can be referred to in the documentation:Example application scenarios

Prerequisites

Using WeChat Mini Program general channels requires enabling full tracking.

If full tracking is not enabled, please refer to "Enabling Full Tracking for Mini Program" to enable it.

If full tracking is already enabled, you can proceed to the second step.

Create a link

Select basic information

Switch to "Promote Mini Program" in the channel management background, select "WeChat Mini Program General Channel", fill in the promotion page URL, starting from version sa2.2.0.504, five types of materials are supported;

Material deliveryExplanationApplicable scenarios
Page pathThe material delivery is still the page path.For scenarios where WeChat public articles have selected the mini program ID, the promotion scene requires filling in the mini program page path.
Short-term valid linkFor material delivery as a link, and this link is valid within 31 days, there is no total frequency limitPromotion methods such as SMS and email require clicking on the link to wake up the mini program. Note that Android phones cannot directly open the link to wake up the mini program and need to be redirected to the H5 page. For details, please refer to the official WeChat documentation https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html
Permanently valid linkFor material delivery as a link, and this link is permanently valid, there is a total frequency limit (100,000 times)
Normal code

For material delivery as a QR code, it can accept shorter page paths, is permanently valid, and there is currently no quantity limitation

Promotion methods such as posters require the mini program QR code for promotion.

Refer to the official WeChat documentation for details https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/qr-code.html

Long codeFor material delivery as a QR code, it can accept longer page paths, is permanently valid, and there is a quantity limit (100,000 times)

Enter channel information

Sensors support inputting the following multidimensional channel information to facilitate subsequent analysis of channel delivery effects by each dimension.

Channel Information

Definition (can be more abundant)

Activity Nameutm_campaign for advertising campaign, generally used to identify the promotion activity name, such as Weekend Sale, Double 11 Event, etc.
Ad Sourceutm_source for advertising campaign source, generally used to identify traffic sources, referral sources URL: baidu, sina, sohu
Advertising MediumAdvertising Campaign Medium utm_medium, usually used to identify advertising medium, marketing medium: cpc, banner, edm
KeywordsAdvertising Campaign Keywords utm_term, usually used to identify paid keywords, mainly applicable to SEM
Advertising ContentAdvertising Campaign Content utm_content, usually used to differentiate ads

Click to complete, the system will automatically generate the redirect link address according to the rules.

Link Distribution

  • Copy the tracking link or short link and promote it on the desired page or medium
  • Advertise in articles in WeChat Official Accounts, ads in WeChat Moments, and ads in mini-programs. The generated links can be used for direct promotion.
  • You can refer to this link for configuring WeChat Moments ad jump to mini-programs: https://ad.weixin.qq.com/landing-page-guide.html#/387

Others

When promoting mini-programs, we need to fill in the page address path of the mini-program in the promotion address to generate the corresponding promotional link.

Step 1: Log in to the WeChat mini-program management background (mp.weixin.qq.com)

Step 2: Enter the mini-program code generation tool, and click to enter

Step 3: Enter the complete and accurate name of the mini-program you want to get the path for (fuzzy search is not supported). After finding it, click Next.

Step 4, click the "Get more page Paths" button

Step 5: In the text box below "① Open the portal", fill in the wechat ID of the current operator and click Open. After successfully opening the portal, the interface will prompt "Successfully opening the portal".

The sixth step, open the wechat mobile client, make sure that you have logged in to the wechat signal just filled in the fifth step, open the small program that you want to obtain the corresponding page path.

Step 7: Visit in the mini program, find the page that needs to be promoted, click the "···" button in the upper right corner, a menu will pop up, and there is a button named "Copy this page path" in the menu, click the button to copy the page path.Note: The copied page path can be used only after deleting the ".html "at the end.

Small program jump small program

Since public library 2.4.0, newly released applets can be jumped to any other applets without any association or binding, by adding UTM-related parameter transfer channel parameters after path, for example:

Suppose the small program A and the small program B, jump from A to the small program B. Then the end of the path provided by the small program B to the small program A can add utm parameters to indicate the source, and the small program A can directly use the path provided by the small program B when implementing the code, so that the small program B integrated with the SDK can realize the source tracking.

wx.navigateToMiniProgram({ appId: '', path: 'page/index/index?utm_source=miniapp_A' })
JS

We will automatically parse the utm information in App.onLaunch App.onShow

Small program code acquisition

Sensors analytics platform supports the generation of small program code, which needs to be filled in Appid and Secret, or directly fill in the value of Access_token. Please ask your RD to ask for any value.

The difference between the two small program codes

Sensors Analytics currently provides two generation modes when generating small program code, as follows:

The reason why there are two modes is that WeChat provides two interfaces. The introduction of these two interfaces is as follows:

wxacode.get: Allows generating up to 100,000 codes, without deletion mechanism, the parameter length of the URL supports 128 bytes. Official documentation: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html wxacode.getUnlimited: Allows generating unlimited codes, the parameter length of the URL supports 32 visible characters. Official documentation: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html

When the Sensors system generates Mini Program codes, it compresses all "utm_xxx" series parameters of Sensors to save the length of the URL parameters. However, it does not compress the original parameters in the client's URL to prevent the interruption of the main process due to the slow response of the Sensors system. Therefore, two request interfaces are provided. If the parameter length of the URL is long, you can use a long code.

Forward Sharing

We know that for sharing in Mini Programs, it is achieved by defining Page.onShareAppMessage, in which the path attribute is used to specify the redirected path. Now there are two options to modify the value of the path to track the channel:

Custom UTM parameters

Add ?utm_source=wang&utm_content=beizi after path to mark that the person sharing it is "wang" and the content being shared is "beizi". We will automatically parse the utm information in App.onLaunch and App.onShow.

Automatic collection of sharing information

1. The above method is a custom solution. Starting from Mini Program 1.9, if allow_amend_share_path is set to true, we will automatically addthe current user's distinct_id , the current sharing count, and the current sharing URL attributes after the path. 2. We will automatically parse this information as $share_distinct_id, $share_depth, $share_url_path in App.onLaunch and App.onShow.

Obtain WeChat group ID

First, in the page where the Mini Program is shared, you need to set share_id, please refer to the WeChat documentation https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html.

wx.showShareMenu({ withShareTicket: true })
JS

Then, when the Mini Program is opened, call the following method to obtain the group ID, please refer to the WeChat documentation https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html.

if (opt.shareTicket) { wx.getShareInfo({ shareTicket: opt.shareTicket; success: function(res){ console.log(res.encryptedData); } }) }
JS

If you want to treat this group ID as a public property, you can use the code sensors.registerApp({latest_share_group_id : group_id});