Tencent advertising (ad.qq.com) is a one-stop advertising platform, with Tencent ecological flow, has a rich and unified ability to put, advertisers on the platform can carry out wechat, QQ, Tencent alliance, application treasure, mobile QQ browser and other channels of advertising.

This paper introduces how Tencent advertising combined with cloud native integration development platform – cloud development CloudBase, released the “Tencent Advertising Assistant” small program end, to achieve the goal of reducing the cost of advertisers looking at the disk, improve advertising optimization efficiency.

I. Project background

In order to reduce the cost of advertisers staring at the disk and improve the efficiency of advertising optimization, Tencent advertising based on this pain point, with the help of cloud development CloudBase ability, released “Tencent Advertising Assistant” small program side, providing multi-account login and switching function, intuitive data reports, lightweight operation and timely new message reminder. For advertisers, service providers to build integrated mobile terminal optimization management solutions, to help advertisers to achieve more efficient and convenient advertising management.

Two, architecture design

1. Business architecture design

“Tencent AD Assistant, as a tool for Tencent’s AD delivery platform, wants to provide advertisers with the ability to manage ads on mobile devices. Therefore, in the small program side, we provide advertisers with the basic capabilities and high-frequency functions on the PC side. The business function design is as follows:

2. Technical architecture design

Tencent’s AD delivery service mainly provides services through MKT API (external) and GDT API (internal) of the open platform, and introduces CloudBase cloud function as BFF (Backend For Frontend) layer on the applet side. The calling level is as shown in the figure below:

On the whole, BFF is a one-layer API designed to meet the requirements of specific client scenarios. It can provide the processed data of multiple back-end microservices to the client through aggregation, tailoring and choreography, etc. As for the functions and data models of product business, they should be converged in the backend API, not in BFF.

Before the project was approved, the team compared various small program development frameworks. After comparing the performance, development efficiency and stability, the original development framework was finally adopted to cooperate with cloud development services. The reasons are as follows:

  • For the small program side has a strong performance requirements, whether the third-party framework compilation or run time scheme, in robustness and performance, the native small program development mode is relatively more suitable;
  • Our applets don’t have to support many different applets, and there’s no historical code migration baggage, and there’s not much difference between the cost of using native development and third-party frameworks;
  • For the difference in the development experience between the native development and the use of the framework, such as the small program does not support LESS, the front-end engineering means will be adopted to solve the problem.

The technology stack currently in use is as follows:

3. Application and practice of CloudBase

1. Aggregate interfaces

In the early stage of small program development, the middle station service was directly called in the front end of small program, and then some problems were encountered. For example, for some pages or functions, it was necessary to call multiple interfaces to obtain data, and then spliced into the final required data. If this logic is done at the front end, it will increase the call link of the entire request, which is multiple client to server requests. If a data request is slow or fails, it will affect the final data and affect the user experience. If it is put on the BFF layer, then it becomes a client to the server request and multiple server to server request, the call link is much shorter than the small program front-end request, and the stability is better.

In the “Tencent Advertising Assistant” small program on the display of the report data will contain summary, sequential, year-on-year data, so you need to combination call different mid-platform interface to get the final data. So the team switched the report related interface on the applet to call the cloud function directly, and the cloud function called the midstation service interface concurrently and aggregated the data back to the applet. At the same time, the data returned in accordance with the small program side needs to return on demand. For example, for the request of the account list page, the front-end originally needs to make three concurrent requests to get the final data, but through the cloud function, the small program side only needs to call one interface.

2. Improve the development experience of cloud functions

Currently, CloudBase officially recommends that layers be used to manage common dependency libraries and code issues. However, from the perspective of development, it is still hoped to achieve native source dependency and reduce the introduction of more concepts and operational costs.

Extracting common code usually requires moving the code up to a common directory or publishing it into an NPM package, whereas in small program cloud functions, each cloud function is a separate directory, with no common directory. When using NPM packages, the costs of debugging, releasing, and updating version numbers are high.

So we pull the common code out into a separate directory within the project, and we use the build tool to synchronize the common code to the directory of each cloud function in real time as we develop and build the code.

Meanwhile, based on cloudBase-Manager-Node SDK, the team implemented local template creation, code and configuration update, and status query of cloud functions in the project, so as to improve the development experience.

View the status of cloud functions:

npm run cf:list
Copy the code

Update code in real time and deploy to the specified environment:

npm run cf:watch -- --func=getUserInfo,mktapi --env:preview
Copy the code

3. Multi-environment deployment and blue-green release scheme

There are 5 cloud development environments of “Tencent AdAssistant”, which correspond to primary environment, secondary environment, test environment, R&D environment and pre-release environment respectively. During development, you can specify which environment to connect to when compiling code through command line, such as:

npm run dev -- --cloudEnv=development
Copy the code

Then our applet will connect to the cloud development environment, and the applet page will display the connected environment on the hover ball.

For the release of cloud functions, the blue-green release strategy is adopted. The primary environment and the secondary environment are available on the Extranet at the same time. When it is released, the traffic will be gradually switched from one side to the other side. If there is no problem, the traffic will be gradually increased.

Here the flow switch logic, can be controlled by the small program released according to the micro signal gray strategy, but also can be controlled by using the feature switch in the small program.

Iv. Project summary and Results

1. Influence

The number of users of “Tencent AD Assistant” has been increasing since its launch at the end of May 2020.

At the same time, as can be seen from the figure below, the small program side is very good to make up for the rush hours and after work advertisers are not near the computer scene. With the small program side, advertisers can manage ads at any time.

2. Benefits of CloudBase development using the cloud

With the help of cloud development capabilities, The Tencent AdAssistant mini program has gained many benefits, including:

  • Cloud functions provide private transport protocols to ensure data transmission.
  • It improves the overall development efficiency and can complete the development of requirements in the scenario of limited human cost;
  • Through the integration of CloudBase-Nod-SDK, one-click deployment is realized, and the operation and maintenance costs are not needed to consider the load.
  • The cloud development method brings great convenience to the coordination, no need to configure agents;
  • Cloud development provides a complete ecosystem and a powerful monitoring system.

reference

Open cloud development: console.cloud.tencent.com/tcb?tdl_anc…

The product documentation: cloud.tencent.com/product/tcb…

Technical documentation: cloudbase.net? From =10004