Unified advertisement space implementation method and device for cross-platform applet and electronic equipment
By implementing a unified ad placement method across mini-programs, the advertising business logic is centrally encapsulated. Independent ad interface services and adapter patterns are adopted to solve the maintenance difficulties and behavior inconsistencies in cross-platform ad implementation, improve development efficiency and data consistency, and support multi-platform expansion.
Patent Information
- Application Number
- CN202610093523.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, cross-platform mini-program advertising implementation suffers from problems such as fragmented business logic, difficult maintenance, complex customization and debugging, and inconsistent behavior, resulting in low development efficiency, high maintenance costs, and data inconsistency.
It adopts a unified ad placement implementation method for cross-platform mini-programs. By instantiating ad UI components at the business layer, calling independent ad interface services, encapsulating ad business logic, and calling mini-program native APIs through platform adapters, it realizes parameter assembly, network requests, exposure reporting, and interactive processing. It supports multi-level degradation strategies and frequency control, and combines the adapter pattern and Stencil compiler to build UI components.
It centralizes advertising business logic and makes platform adaptation transparent, improves development efficiency and system maintainability, ensures data consistency and user experience, reduces labor costs, and supports the rapid expansion of new platforms.
Smart Images

Figure CN122048443A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mini-program application development technology, and in particular to a method, apparatus and electronic device for implementing a unified advertising space in cross-platform mini-programs. Background Technology
[0002] With the development of the WeChat Mini Program ecosystem across multiple platforms such as WeChat, Alipay, and Douyin, enterprises generally adopt a hybrid development architecture of "native shell + H5 business module" in order to achieve a balance between development efficiency and performance. Under this architecture, advertising, as a key commercialization component, faces significant challenges in its implementation: as part of the H5 business module, the advertising function needs to be easily integrated into business projects with different technology stacks (such as Vue and React); at the same time, its complete functionality deeply relies on calling the native APIs (such as network requests and page redirects) of various Mini Program platforms that are incompatible with each other, as well as the corresponding business logic such as event tracking and reporting.
[0003] Currently, the typical solution in the industry is a layered approach of "general tool library + UI component". In this approach, the bottom layer provides a general tool library that encapsulates the API differences across platforms (such as a unified httpRequest function), while the top layer provides a third-party UI advertising component. This approach has the following main drawbacks: (1) Dispersed business logic and difficult maintenance: The core business logic of advertising (such as parameter assembly, exposure / click reporting rules, and jump processing) lacks independent encapsulation. In projects without UI components, this logic is scattered in each business code; in projects with UI components, this logic is encapsulated inside the UI components, becoming a "black box". Any change in business rules requires multiple modifications or in-depth "black box" modifications, resulting in high maintenance costs and difficulty in ensuring consistency.
[0004] (2) The “black box” nature leads to complex customization and debugging: UI components are deeply coupled with business logic and platform adaptation, and the internal implementation is not transparent, making it difficult for business parties to customize specific processes (such as adding pre-jump verification), and the debugging path is long and inefficient when problems occur.
[0005] (3) The dual-track model leads to inconsistent behavior: different projects within the same company may adopt the mode of directly calling the tool library or introducing "black box" UI components, resulting in inconsistent behavior and data reporting of the same ad space in different projects, causing operational data chaos and technical knowledge fragmentation.
[0006] Therefore, a method, device, and electronic device for implementing a unified advertising space in cross-platform mini-programs are proposed. Summary of the Invention
[0007] This specification provides a method, device, and electronic device for implementing a unified advertising space in cross-platform mini-programs, which can centralize advertising business logic, make platform adaptation transparent, standardize access modes, and effectively improve development efficiency, system maintainability, and data consistency.
[0008] This manual provides a method for implementing a unified ad placement in cross-platform mini-programs, including: Instantiate the advertising UI component at the business layer and pass in the advertising slot identifier; Through the advertising UI component, an independent advertising interface service is called, and the standardized advertising data that has been processed is obtained by taking the advertising slot identifier as input. The advertising interface service encapsulates complete advertising business logic and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting. The advertising UI component renders the data based on the standardized advertising data. In response to user interaction with the rendered advertisement, the advertisement UI component calls the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and call the native navigation API through the platform adapter to realize the jump.
[0009] Optionally, when the advertising interface service executes network requests, it adopts a three-level degradation strategy to ensure the success rate of the requests: When the main request interface call fails, firstly, a first-level degradation is performed, that is, the main request interface is retried according to the preset number of retries; If the first-level downgrade is still unsuccessful, the second-level downgrade will be executed, switching to the backup ad request interface to re-initiate the request. The backup ad request interface has a different service address or path from the main request interface. If the second-level downgrade is still unsuccessful, a third-level downgrade will be executed, calling a public advertising interface that does not require user authentication to obtain backup advertising content, ensuring that the advertising slots have content to display under any abnormal circumstances.
[0010] Optionally, the parameter assembly process of the advertising interface service includes: Automatically obtain user identity, device identity, application version number and network environment information through the native API of the current mini program platform; The acquired environmental information is combined with the ad slot identifier, the preset application identifier, and the timestamp to generate complete request parameters that meet the requirements of the ad server. The user identity identifier includes, but is not limited to, user ID, open ID, or anonymous device ID, and the device identifier includes device model, operating system version, and screen resolution.
[0011] Optionally, the unified interaction processing procedure of the advertising interface service specifically includes: When the advertising UI component calls the interaction processing interface, it iterates through the multiple click tracking URLs carried in the standardized advertising data and initiates click reporting requests concurrently or sequentially through the platform adapter; The jump target configuration in the standardized advertising data is parsed. The configuration describes the jump type, target mini-program application ID, page path and passed parameters in a structured data format. Based on the parsing results and the currently running mini-program platform, the native page navigation API is called through the corresponding platform adapter to achieve unified navigation across mini-programs.
[0012] Optionally, the platform adapter is implemented using the adapter pattern, including: During the system initialization phase, the current mini-program platform type is determined by running environment variables or feature detection; Based on the determined platform type, the corresponding adapter implementation module is dynamically loaded. Each platform adapter module implements a set of predefined unified interfaces, including network request interface, data storage interface and navigation interface. During the execution of advertising business, all native API calls of the advertising interface service are completed by calling the unified interface of the corresponding adapter module, which is converted into the native calling syntax of the specific platform by the adapter.
[0013] Optionally, the advertising UI component is built as a standard Web Components custom element based on the Stencil compiler, including: Define observable attributes for receiving the ad placement identifier and configuration parameters; In the component lifecycle function, listen for attribute changes and automatically call the unified request interface of the advertising interface service; Implement a render() method that dynamically generates the ad DOM structure based on the acquired ad data, supporting various ad creative formats such as images, videos, and mixed text and images; Bind event listeners to the generated DOM elements, and encapsulate the call to the unified interactive processing interface of the advertising interface service in the event callback function.
[0014] Optionally, the method further includes an ad display frequency control mechanism: Before the advertising UI component renders the advertisement, check if there are any display records for the current advertisement slot in the local storage. If a record exists and the number of times it has been displayed has reached the preset daily display limit, then cancel the rendering of this advertisement and keep the component hidden. If the upper limit is not reached or no record exists, the normal rendering process will be executed, and the display record in local storage will be updated after successful rendering. The frequency control mechanism runs independently on the client side, without relying on server-side control, reducing network requests and improving response speed.
[0015] This specification provides a unified advertising placement implementation device for cross-platform mini-programs, including: The input module is used to instantiate the advertising UI component at the business layer and pass in the advertising slot identifier; The acquisition module is used to call an independent advertising interface service through the advertising UI component, and obtain the processed standardized advertising data with the advertising slot identifier as input; wherein, the advertising interface service encapsulates complete advertising business logic, and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting; A rendering module is used to render the standardized advertising data using the advertising UI component. The jump module is used to respond to user interaction with the rendered advertisement. Through the advertisement UI component, it calls the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and realize the jump by calling the native navigation API through the platform adapter.
[0016] Optionally, when the advertising interface service executes network requests, it adopts a three-level degradation strategy to ensure the success rate of the requests: When the main request interface call fails, firstly, a first-level degradation is performed, that is, the main request interface is retried according to the preset number of retries; If the first-level downgrade is still unsuccessful, the second-level downgrade will be executed, switching to the backup ad request interface to re-initiate the request. The backup ad request interface has a different service address or path from the main request interface. If the second-level downgrade is still unsuccessful, a third-level downgrade will be executed, calling a public advertising interface that does not require user authentication to obtain backup advertising content, ensuring that the advertising slots have content to display under any abnormal circumstances.
[0017] Optionally, the parameter assembly process of the advertising interface service includes: Automatically obtain user identity, device identity, application version number and network environment information through the native API of the current mini program platform; The acquired environmental information is combined with the ad slot identifier, the preset application identifier, and the timestamp to generate complete request parameters that meet the requirements of the ad server. The user identity identifier includes, but is not limited to, user ID, open ID, or anonymous device ID, and the device identifier includes device model, operating system version, and screen resolution.
[0018] Optionally, the unified interaction processing procedure of the advertising interface service specifically includes: When the advertising UI component calls the interaction processing interface, it iterates through the multiple click tracking URLs carried in the standardized advertising data and initiates click reporting requests concurrently or sequentially through the platform adapter; The jump target configuration in the standardized advertising data is parsed. The configuration describes the jump type, target mini-program application ID, page path and passed parameters in a structured data format. Based on the parsing results and the currently running mini-program platform, the native page navigation API is called through the corresponding platform adapter to achieve unified navigation across mini-programs.
[0019] Optionally, the platform adapter is implemented using the adapter pattern, including: During the system initialization phase, the current mini-program platform type is determined by running environment variables or feature detection; Based on the determined platform type, the corresponding adapter implementation module is dynamically loaded. Each platform adapter module implements a set of predefined unified interfaces, including network request interface, data storage interface and navigation interface. During the execution of advertising business, all native API calls of the advertising interface service are completed by calling the unified interface of the corresponding adapter module, which is converted into the native calling syntax of the specific platform by the adapter.
[0020] Optionally, the advertising UI component is built as a standard Web Components custom element based on the Stencil compiler, including: Define observable attributes for receiving the ad placement identifier and configuration parameters; In the component lifecycle function, listen for attribute changes and automatically call the unified request interface of the advertising interface service; Implement a render() method that dynamically generates the ad DOM structure based on the acquired ad data, supporting various ad creative formats such as images, videos, and mixed text and images; Bind event listeners to the generated DOM elements, and encapsulate the call to the unified interactive processing interface of the advertising interface service in the event callback function.
[0021] Optionally, the method further includes an ad display frequency control mechanism: Before the advertising UI component renders the advertisement, check if there are any display records for the current advertisement slot in the local storage. If a record exists and the number of times it has been displayed has reached the preset daily display limit, then cancel the rendering of this advertisement and keep the component hidden. If the upper limit is not reached or no record exists, the normal rendering process will be executed, and the display record in local storage will be updated after successful rendering. The frequency control mechanism runs independently on the client side, without relying on server-side control, reducing network requests and improving response speed.
[0022] This specification also provides an electronic device, wherein the electronic device includes: A processor; and a memory storing computer-executable instructions, which, when executed, cause the processor to perform any of the methods described above.
[0023] This specification also provides a computer-readable storage medium that stores one or more programs that, when executed by a processor, implement any of the methods described above.
[0024] This invention employs a disruptive architecture design of a "dedicated advertising interface layer + pure UI component layer" to centralize and encapsulate the complex business logic of advertising (parameter assembly, multi-level degradation, reporting, and redirection). This simplifies the integration work for business developers from a "development task" requiring in-depth understanding of platform differences to a configuration integration that only requires declaring the ad slot ID. The development and debugging cycle for advertising functions is shortened from days / weeks to minutes, significantly improving development efficiency and reducing labor costs. Secondly, this architecture completely solves the dual-track maintenance dilemma caused by fragmented business logic and the debugging and customization difficulties brought about by black-box UI components in existing technologies. Any change in business rules only needs to be modified once in the unified interface layer to take effect across all platforms, ensuring absolute consistency of system behavior and making problem localization paths clear and maintenance costs significantly reduced. Furthermore, the intelligent multi-level degradation strategy built into the interface layer, especially the final call to the public advertising interface that does not require authentication for content fallback, systematically reduces the blank rate of ad slots to near zero, significantly improving user experience and the commercial reliability of the page. Meanwhile, the automated and standardized exposure and click reporting mechanisms ensure the accuracy and comparability of advertising performance data across the entire platform, providing a reliable basis for commercial decisions. Finally, the platform isolation design based on the adapter pattern gives the system excellent scalability, supporting new mini-program platforms by only adding one adapter file, without changing the core business logic, achieving one-time development and multi-platform deployment at extremely low marginal cost. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A schematic diagram illustrating the principle of a unified advertising space implementation method for cross-platform mini-programs provided in the embodiments of this specification; Figure 2 A schematic diagram of a unified advertising space implementation device for cross-platform mini-programs provided in the embodiments of this specification; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification; Figure 4 This is a schematic diagram of a computer-readable medium provided for embodiments of this specification. Detailed Implementation
[0027] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious variations will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.
[0028] The following is in conjunction with the appendix Figure 1-4 Exemplary embodiments of the invention will be described more fully here. However, exemplary embodiments can be implemented in many forms and should not be construed as limiting the invention to the embodiments set forth herein. Rather, these exemplary embodiments are provided to make the invention more comprehensive and complete, and to facilitate a full communication of the inventive concept to those skilled in the art. The same reference numerals in the figures denote the same or similar elements, components, or parts, and therefore repeated descriptions of them are omitted.
[0029] Subject to the technical concept of this invention, the features, structures, characteristics or other details described in a particular embodiment may be combined in one or more other embodiments in a suitable manner.
[0030] In the description of specific embodiments, the features, structures, characteristics, or other details described in this invention are intended to enable those skilled in the art to fully understand the embodiments. However, it is not excluded that those skilled in the art can practice the technical solutions of this invention without one or more of the specific features, structures, characteristics, or other details.
[0031] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0032] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0033] The terms “and / or” or “and / or” include all combinations of any one or more of the listed items.
[0034] Figure 1 This is a schematic diagram illustrating the principle of a method for implementing a unified advertising space in a cross-platform mini-program, as provided in an embodiment of this specification. The method may include: S110: Instantiate the advertising UI component in the business layer and pass in the advertising slot identifier; S120: Through the advertising UI component, call the independent advertising interface service, take the advertising slot identifier as input, and obtain the processed standardized advertising data; wherein, the advertising interface service encapsulates complete advertising business logic, and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting; S130: Render the advertisement based on the standardized advertisement data using the advertisement UI component; S140: In response to user interaction with the rendered advertisement, the advertisement UI component is used to call the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and call the native navigation API through the platform adapter to realize the jump.
[0035] In the specific implementation of this specification, in the business layer (such as a Vue / React project), developers declare similar... <wowoo-popup data="{siteName:'home_banner'}">A custom HTML tag is used to instantiate the ad UI component, passing in the ad placement identifier. After mounting, this UI component automatically calls the `adRequest(siteName)` method of a separate `AdService` instance published as an NPM package. This `AdService` is the ad interface service; it's not simply a collection of utility functions, but rather a cohesive business chain encompassing assembling context parameters based on `siteName`, selecting request strategies, handling network requests, implementing error fallback, and automatically triggering exposure reporting. During this process, all operations requiring calls to native WeChat Mini Program capabilities (such as network requests wx.request / my.request) are handled through a platform adapter layer, thus isolating business logic from platform differences. Once the `AdService` returns unified `UnifiedAdData`, the UI component renders. When a user clicks on an ad, the UI component calls the `AdService.onAdClick(adData)` method, which automatically completes click reporting and uses the same platform adapter to call native APIs such as `wx.navigateToMiniProgram` for precise redirection.
[0036] Optionally, when the advertising interface service executes network requests, it adopts a three-level degradation strategy to ensure the success rate of the requests: When the main request interface call fails, firstly, a first-level degradation is performed, that is, the main request interface is retried according to the preset number of retries; If the first-level downgrade is still unsuccessful, the second-level downgrade will be executed, switching to the backup ad request interface to re-initiate the request. The backup ad request interface has a different service address or path from the main request interface. If the second-level downgrade is still unsuccessful, a third-level downgrade will be executed, calling a public advertising interface that does not require user authentication to obtain backup advertising content, ensuring that the advertising slots have content to display under any abnormal circumstances.
[0037] In the specific implementation described in this specification, within the AdService, the request processing core module first attempts to retrieve the advertisement through the main interface (carrying the user's token). If this fails (e.g., network timeout, token expiration), a first-level fallback is triggered: a maximum of two retries within 2 seconds. If this also fails, a second-level fallback is initiated: switching to a backup domain interface in a configuration item (e.g., switching from api.primary.com to api.fallback.com) to re-request. As a final safeguard, if the backup interface also fails (e.g., no network at all), a third-level fallback is activated: calling a public advertising interface that does not require any user identity information. This interface consistently returns a set of preset brand public service advertisements or promotional content, thereby ensuring that the ad slot will not be blank under any abnormal circumstances, significantly improving the overall page experience and guaranteed commercial revenue.
[0038] Optionally, the parameter assembly process of the advertising interface service includes: Automatically obtain user identity, device identity, application version number and network environment information through the native API of the current mini program platform; The acquired environmental information is combined with the ad slot identifier, the preset application identifier, and the timestamp to generate complete request parameters that meet the requirements of the ad server. The user identity identifier includes, but is not limited to, user ID, open ID, or anonymous device ID, and the device identifier includes device model, operating system version, and screen resolution.
[0039] In the specific implementation described in this specification, the parameter assembly process is fully automated and transparent to business developers. When adRequest(siteName) is invoked, the service first calls native APIs such as wx.getSystemInfo and my.getEnv through the platform adapter to synchronously obtain environmental information such as the current device's userId, deviceId, appVersion, platform (platform type), and screenWidth. Simultaneously, it asynchronously obtains the login state token. Then, this dynamically obtained information is combined with the passed static parameter siteName, the globally injected appId during pre-compilation, and the current timestamp, according to the protocol format agreed upon by the server, to generate the final request message. This design ensures that all necessary business parameters and tracking dimensions are injected uniformly and automatically, eliminating omissions or errors caused by manual transmission.
[0040] Optionally, the unified interaction processing procedure of the advertising interface service specifically includes: When the advertising UI component calls the interaction processing interface, it iterates through the multiple click tracking URLs carried in the standardized advertising data and initiates click reporting requests concurrently or sequentially through the platform adapter; The jump target configuration in the standardized advertising data is parsed. The configuration describes the jump type, target mini-program application ID, page path and passed parameters in a structured data format. Based on the parsing results and the currently running mini-program platform, the native page navigation API is called through the corresponding platform adapter to achieve unified navigation across mini-programs.
[0041] In the specific implementation described in this specification, the unified interaction processing is encapsulated in the `AdService.onAdClick(adData)` method. When a UI component triggers a click event and calls this method, the method first iterates through the pre-defined `clickTrackUrls` array (which typically contains multiple monitoring links) in the `adData` object, and initiates silent GET requests one by one through the platform adapter to complete the click effect reporting. Then, it parses the `action` field in `adData`, which is a structured JSON object, such as `{type:'miniProgram',appId:'xxxx',path:' / pages / detail?id=123'}`. `AdService` determines the jump type based on `type` and extracts the target information. Finally, it calls the corresponding platform's native navigation method (such as WeChat's `wx.navigateToMiniProgram`, and Alipay's `my.navigateToMiniProgram`) through the platform adapter to achieve seamless and correct cross-mini-program jumps, without requiring the business side to write any platform-based judgment code.
[0042] Optionally, the platform adapter is implemented using the adapter pattern, including: During the system initialization phase, the current mini-program platform type is determined by running environment variables or feature detection; Based on the determined platform type, the corresponding adapter implementation module is dynamically loaded. Each platform adapter module implements a set of predefined unified interfaces, including network request interface, data storage interface and navigation interface. During the execution of advertising business, all native API calls of the advertising interface service are completed by calling the unified interface of the corresponding adapter module, which is converted into the native calling syntax of the specific platform by the adapter.
[0043] In the specific implementation described in this specification, the platform adapter layer adopts the classic adapter pattern. The project build artifacts include several independent files such as wechat-adapter.js and alipay-adapter.js. During system initialization, the current runtime environment is detected using methods such as `typeof wx !=='undefined'` or `process.env.APP_PLATFORM`. Subsequently, the corresponding adapter modules are dynamically required or imported. Each adapter module implements the same interface contract, such as `request(options)`, `navigateTo(options)`, and `getStorage(key)`. When the AdService needs to initiate a network request, it calls `platformAdapter.request({url,method,data})`. For the WeChat environment, the `request` method in wechat-adapter.js` is internally converted to `wx.request({…})`; for the Alipay environment, it is converted to `my.request({…})`. This approach completely encapsulates platform differences within the adapter; when adding new platform support, only a new adapter file needs to be written, with zero modification to the core business code.
[0044] Optionally, the advertising UI component is built as a standard Web Components custom element based on the Stencil compiler, including: Define observable attributes for receiving the ad placement identifier and configuration parameters; In the component lifecycle function, listen for attribute changes and automatically call the unified request interface of the advertising interface service; Implement a render() method that dynamically generates the ad DOM structure based on the acquired ad data, supporting various ad creative formats such as images, videos, and mixed text and images; Bind event listeners to the generated DOM elements, and encapsulate the call to the unified interactive processing interface of the advertising interface service in the event callback function.
[0045] In the specific implementation described in this manual, the advertising UI component is built using the Stencil compiler. Developers import the component library via `npm install wowoo-ad-ui`. In the Stencil component class, observable properties such as `siteName` are defined using the `@Prop()` decorator. In the `componentDidLoad()` or `componentWillRender()` lifecycle hooks, property changes are monitored, and `AdService.adRequest(this.siteName)` is executed. The core of the component is a `render()` method, which returns JSX or Hyperscript and dynamically generates an ad based on the `creativeType` (e.g., 'IMAGE', 'VIDEO') and `photoUrl` fields in `adData`. , <video>Or containing copywriting The DOM structure is then rendered. After rendering, the click callback is set to `AdService.onAdClick(this.currentAdData)` in `host.addEventListener('click',...)` or in element-level event binding. Finally, Stencil compiles it into standard Web Components, which can be used in any framework. <wowoo-popup>Use the tags directly.
[0046] Optionally, the method further includes an ad display frequency control mechanism: Before the advertising UI component renders the advertisement, check if there are any display records for the current advertisement slot in the local storage. If a record exists and the number of times it has been displayed has reached the preset daily display limit, then cancel the rendering of this advertisement and keep the component hidden. If the upper limit is not reached or no record exists, the normal rendering process will be executed, and the display record in local storage will be updated after successful rendering. The frequency control mechanism runs independently on the client side, without relying on server-side control, reducing network requests and improving response speed.
[0047] In the specific implementation described in this specification, the client-side frequency control mechanism is implemented within the UI component as a pre-rendering validation step. Before the component's `render()` method is called, a `checkFrequency(siteName)` function is executed. This function reads the local cache via a platform adapter call such as `wx.getStorageSync('AD_SHOW_COUNT_'+siteName+'_'+today)`. The cache data structure is `{count:5,date:'2023-10-01'}`. The component configuration presets a daily limit for this ad slot (e.g., 3 times). The function compares the current date with the cached date; if the dates are different, the count is reset; if the dates are the same and `count>=3`, the component sets `this.visible` to `false`, causing `render()` to return `null`, and the ad is not displayed. If the limit is not reached, the count is updated via `wx.setStorage` after rendering. This mechanism runs entirely on the client side, incurring no additional network overhead and effectively managing the user experience.
[0048] The advertising API service is systematically encapsulated internally using the Facade Pattern. The exposed AdService object (containing only highly cohesive methods like adRequest and onAdClick) presents a simple facade, while internally it integrates multiple cooperating sub-modules: an environment detector responsible for detecting the runtime environment, a parameter assembler for assembling business and user data according to policies, a request scheduler for executing multi-level degradation processes, and a reporting trigger that automatically triggers event tracking. This design allows business developers to drive a series of complex, well-tested business processes behind the scenes through a simple API call, truly realizing the service-oriented nature of advertising capabilities and shifting the development mindset from "how to implement" to "declarative use."
[0049] To achieve seamless cross-platform data flow, this invention defines a mandatory standardized advertising data model (UnifiedAdData). This model serves as a unified contract for data returned by advertising interfaces across all platforms. Its core fields include, but are not limited to: creativeId (unique creative identifier), photoUrl (image or video resource URL), title (ad copy), clickUrl (structured target object for redirection), exposeUrls (an array of exposure tracking URLs), and clickTrackUrls (an array of click tracking URLs). This model is designed with foresight and scalability in mind. When supporting new advertising creatives in the future (such as interactive ads), only the corresponding fields need to be added to the model, and the rendering logic of the UI components extended, while the core business logic of the interface layer remains stable, conforming to the open / closed principle.
[0050] Regarding the integration and dependencies between the advertising UI components and the advertising API service, this invention adopts an engineered, loosely coupled design. In the component library's `package.json`, `AdService` is declared as a `peerDependency`, indicating that the two are equal dependencies that work together. In actual business projects, developers need to install both `wowoo-ad-ui` and `wowoo-ad-service`, two independent NPM packages, and initialize `AdService` at the application entry point. Internally, the UI components use the standard ESModule syntax `import {adRequest, onAdClick} from 'wowoo-ad-service';` to obtain service methods. This explicit import dependency relationship is clearer, easier to test, and ensures the purity of the UI layer compared to black-box coupling or global variable injection.
[0051] To ensure system observability and stability, this invention implements enhanced error handling and comprehensive monitoring within the interface service. At every critical stage, including request assembly, network calls, data parsing, reporting, and navigation, exceptions are captured using try-catch blocks. Captured errors are not simply ignored; instead, they are reported along with context such as error code, stage of occurrence, ad slot ID, and device information, through a separate monitoring log interface also hosted by the platform adapter. This provides a complete data chain for rapid online problem localization, troubleshooting, and system optimization, significantly improving operational efficiency.
[0052] To provide operators with flexibility, this invention supports dynamic configuration based on business needs. The ad placement identifier `siteName` is not merely a static ID; it can also be associated with a dynamic mapping table issued from a remote configuration center during AdService initialization. This configuration table can define the primary / backup interface address for each `siteName`, specific parameters of the degradation strategy (such as retry timeout), and the upper limit for client frequency control. Through this mechanism, operators can dynamically adjust ad request strategies or display rules without releasing new client versions, enabling rapid iteration and canary releases of business strategies and improving the agility of business response.
[0053] This invention employs a disruptive architecture design of a "dedicated advertising interface layer + pure UI component layer" to centralize and encapsulate the complex business logic of advertising (parameter assembly, multi-level degradation, reporting, and redirection). This simplifies the integration work for business developers from a "development task" requiring in-depth understanding of platform differences to a configuration integration that only requires declaring the ad slot ID. The development and debugging cycle for advertising functions is shortened from days / weeks to minutes, significantly improving development efficiency and reducing labor costs. Secondly, this architecture completely solves the dual-track maintenance dilemma caused by fragmented business logic and the debugging and customization difficulties brought about by black-box UI components in existing technologies. Any change in business rules only needs to be modified once in the unified interface layer to take effect across all platforms, ensuring absolute consistency of system behavior and making problem localization paths clear and maintenance costs significantly reduced. Furthermore, the intelligent multi-level degradation strategy built into the interface layer, especially the final call to the public advertising interface that does not require authentication for content fallback, systematically reduces the blank rate of ad slots to near zero, significantly improving user experience and the commercial reliability of the page. Meanwhile, the automated and standardized exposure and click reporting mechanisms ensure the accuracy and comparability of advertising performance data across the entire platform, providing a reliable basis for commercial decisions. Finally, the platform isolation design based on the adapter pattern gives the system excellent scalability, supporting new mini-program platforms by only adding one adapter file, without changing the core business logic, achieving one-time development and multi-platform deployment at extremely low marginal cost.
[0054] Figure 2 This specification provides a schematic diagram of a unified advertising space implementation device for cross-platform mini-programs, which may include: The input module is used to instantiate the advertising UI component at the business layer and pass in the advertising slot identifier; The acquisition module is used to call an independent advertising interface service through the advertising UI component, and obtain the processed standardized advertising data with the advertising slot identifier as input; wherein, the advertising interface service encapsulates complete advertising business logic, and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting; A rendering module is used to render the standardized advertising data using the advertising UI component. The jump module is used to respond to user interaction with the rendered advertisement. Through the advertisement UI component, it calls the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and realize the jump by calling the native navigation API through the platform adapter.
[0055] Optionally, when the advertising interface service executes network requests, it adopts a three-level degradation strategy to ensure the success rate of the requests: When the main request interface call fails, firstly, a first-level degradation is performed, that is, the main request interface is retried according to the preset number of retries; If the first-level downgrade is still unsuccessful, the second-level downgrade will be executed, switching to the backup ad request interface to re-initiate the request. The backup ad request interface has a different service address or path from the main request interface. If the second-level downgrade is still unsuccessful, a third-level downgrade will be executed, calling a public advertising interface that does not require user authentication to obtain backup advertising content, ensuring that the advertising slots have content to display under any abnormal circumstances.
[0056] Optionally, the parameter assembly process of the advertising interface service includes: Automatically obtain user identity, device identity, application version number and network environment information through the native API of the current mini program platform; The acquired environmental information is combined with the ad slot identifier, the preset application identifier, and the timestamp to generate complete request parameters that meet the requirements of the ad server. The user identity identifier includes, but is not limited to, user ID, open ID, or anonymous device ID, and the device identifier includes device model, operating system version, and screen resolution.
[0057] Optionally, the unified interaction processing procedure of the advertising interface service specifically includes: When the advertising UI component calls the interaction processing interface, it iterates through the multiple click tracking URLs carried in the standardized advertising data and initiates click reporting requests concurrently or sequentially through the platform adapter; The jump target configuration in the standardized advertising data is parsed. The configuration describes the jump type, target mini-program application ID, page path and passed parameters in a structured data format. Based on the parsing results and the currently running mini-program platform, the native page navigation API is called through the corresponding platform adapter to achieve unified navigation across mini-programs.
[0058] Optionally, the platform adapter is implemented using the adapter pattern, including: During the system initialization phase, the current mini-program platform type is determined by running environment variables or feature detection; Based on the determined platform type, the corresponding adapter implementation module is dynamically loaded. Each platform adapter module implements a set of predefined unified interfaces, including network request interface, data storage interface and navigation interface. During the execution of advertising business, all native API calls of the advertising interface service are completed by calling the unified interface of the corresponding adapter module, which is converted into the native calling syntax of the specific platform by the adapter.
[0059] Optionally, the advertising UI component is built as a standard Web Components custom element based on the Stencil compiler, including: Define observable attributes for receiving the ad placement identifier and configuration parameters; In the component lifecycle function, listen for attribute changes and automatically call the unified request interface of the advertising interface service; Implement a render() method that dynamically generates the ad DOM structure based on the acquired ad data, supporting various ad creative formats such as images, videos, and mixed text and images; Bind event listeners to the generated DOM elements, and encapsulate the call to the unified interactive processing interface of the advertising interface service in the event callback function.
[0060] Optionally, the method further includes an ad display frequency control mechanism: Before the advertising UI component renders the advertisement, check if there are any display records for the current advertisement slot in the local storage. If a record exists and the number of times it has been displayed has reached the preset daily display limit, then cancel the rendering of this advertisement and keep the component hidden. If the upper limit is not reached or no record exists, the normal rendering process will be executed, and the display record in local storage will be updated after successful rendering. The frequency control mechanism runs independently on the client side, without relying on server-side control, reducing network requests and improving response speed.
[0061] The functions of the apparatus in this embodiment have been described in the above method embodiments. Therefore, for any parts not detailed in this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.
[0062] Based on the same inventive concept, embodiments of this specification also provide an electronic device.
[0063] The following describes embodiments of the electronic device of the present invention, which can be considered as specific implementations of the methods and apparatus embodiments of the present invention described above. Details described in the embodiments of the electronic device of the present invention should be considered as supplements to the methods or apparatus embodiments described above; details not disclosed in the embodiments of the electronic device of the present invention can be implemented with reference to the methods or apparatus embodiments described above.
[0064] Figure 3 This is a schematic diagram of an electronic device provided as an embodiment of this specification. Refer to the following... Figure 3 The electronic device 300 according to this embodiment of the present invention will be described. Figure 3 The electronic device 300 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0065] like Figure 3 As shown, the electronic device 300 is presented in the form of a general-purpose computing device. The components of the electronic device 300 may include, but are not limited to: at least one processing unit 310, at least one storage unit 320, a bus 330 connecting different system components (including storage unit 320 and processing unit 310), a display unit 340, etc.
[0066] The storage unit stores program code that can be executed by the processing unit 310, causing the processing unit 310 to perform the steps described in the processing method section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 310 can perform, for example... Figure 1 The steps are shown.
[0067] The storage unit 320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 3201 and / or a cache storage unit 3202, and may further include a read-only memory unit (ROM) 3203.
[0068] The storage unit 320 may also include a program / utility 3204 having a set (at least one) program module 3205, such program module 3205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0069] Bus 330 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0070] Electronic device 300 can also communicate with one or more external devices 400 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable viewers to interact with electronic device 300, and / or with any device that enables electronic device 300 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 350. Furthermore, electronic device 300 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 360. Network adapter 360 can communicate with other modules of electronic device 300 via bus 330. It should be understood that, although... Figure 3 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0071] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described in this invention can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the method described above according to this invention. When the computer program is executed by a data processing device, it enables the computer-readable medium to implement the method described above, i.e.: as... Figure 1 The method shown.
[0072] Figure 4 This is a schematic diagram of a computer-readable medium provided for embodiments of this specification.
[0073] accomplish Figure 1 The computer program of the method shown can be stored on one or more computer-readable media. A computer-readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0074] The computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0075] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the audience's computing device, partially on the audience's device, as a standalone software package, partially on the audience's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the audience's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0076] In summary, this invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that in practice, general-purpose data processing devices such as microprocessors or digital signal processors (DSPs) can be used to implement some or all of the functions of some or all of the components according to the embodiments of the invention. The invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the invention can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0077] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the present invention is not inherently related to any specific computer, virtual device, or electronic device, and various general-purpose devices can also implement the present invention. The above descriptions are merely specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0078] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0079] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application. < / video>
Claims
1. A method for implementing a unified advertising space in cross-platform mini-programs, characterized in that, include: Instantiate the advertising UI component at the business layer and pass in the advertising slot identifier; Through the advertising UI component, an independent advertising interface service is called, and the standardized advertising data that has been processed is obtained by taking the advertising slot identifier as input. The advertising interface service encapsulates complete advertising business logic and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting. The advertising UI component renders the data based on the standardized advertising data. In response to user interaction with the rendered advertisement, the advertisement UI component calls the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and call the native navigation API through the platform adapter to realize the jump.
2. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, When the advertising interface service executes network requests, it employs a three-level degradation strategy to ensure request success rate: When the main request interface call fails, firstly, a first-level degradation is performed, that is, the main request interface is retried according to the preset number of retries; If the first-level downgrade is still unsuccessful, the second-level downgrade will be executed, switching to the backup ad request interface to re-initiate the request. The backup ad request interface has a different service address or path from the main request interface. If the second-level downgrade is still unsuccessful, a third-level downgrade will be executed, calling a public advertising interface that does not require user authentication to obtain backup advertising content, ensuring that the advertising slots have content to display under any abnormal circumstances.
3. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, The parameter assembly process for the advertising interface service includes: Automatically obtain user identity, device identity, application version number and network environment information through the native API of the current mini program platform; The acquired environmental information is combined with the ad slot identifier, the preset application identifier, and the timestamp to generate complete request parameters that meet the requirements of the ad server. The user identity identifier includes, but is not limited to, user ID, open ID, or anonymous device ID, and the device identifier includes device model, operating system version, and screen resolution.
4. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, The unified interactive processing procedure of the advertising interface service specifically includes: When the advertising UI component calls the interaction processing interface, it iterates through the multiple click tracking URLs carried in the standardized advertising data and initiates click reporting requests concurrently or sequentially through the platform adapter; The jump target configuration in the standardized advertising data is parsed. The configuration describes the jump type, target mini-program application ID, page path and passed parameters in a structured data format. Based on the parsing results and the currently running mini-program platform, the native page navigation API is called through the corresponding platform adapter to achieve unified navigation across mini-programs.
5. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, The platform adapter is implemented using the adapter pattern and includes: During the system initialization phase, the current mini-program platform type is determined by running environment variables or feature detection; Based on the determined platform type, the corresponding adapter implementation module is dynamically loaded. Each platform adapter module implements a set of predefined unified interfaces, including network request interface, data storage interface and navigation interface. During the execution of advertising business, all native API calls of the advertising interface service are completed by calling the unified interface of the corresponding adapter module, which is converted into the native calling syntax of the specific platform by the adapter.
6. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, The advertising UI component is built using the Stencil compiler as a standard Web Components custom element, including: Define observable attributes to receive the ad placement identifier and configuration parameters; In the component lifecycle function, listen for attribute changes and automatically call the unified request interface of the advertising interface service; Implement a render() method that dynamically generates the ad DOM structure based on the acquired ad data, supporting various ad creative formats such as images, videos, and mixed text and images; Bind event listeners to the generated DOM elements, and encapsulate the call to the unified interactive processing interface of the advertising interface service in the event callback function.
7. The method for implementing a unified advertising space in cross-platform mini-programs as described in claim 1, characterized in that, The method also includes an ad display frequency control mechanism: Before the advertising UI component renders the advertisement, check if there are any display records for the current advertisement slot in the local storage. If a record exists and the number of times it has been displayed has reached the preset daily display limit, then cancel the rendering of this advertisement and keep the component hidden. If the upper limit is not reached or no record exists, the normal rendering process will be executed, and the display record in local storage will be updated after successful rendering. The frequency control mechanism runs independently on the client side, without relying on server-side control, reducing network requests and improving response speed.
8. A unified advertising space implementation device for cross-platform mini-programs, characterized in that, include: The input module is used to instantiate the advertising UI component at the business layer and pass in the advertising slot identifier; The acquisition module is used to call an independent advertising interface service through the advertising UI component, and obtain the processed standardized advertising data with the advertising slot identifier as input; wherein, the advertising interface service encapsulates complete advertising business logic, and internally calls the mini program's native API through the platform adapter to complete the entire process from parameter assembly, network request, error fallback to exposure reporting; A rendering module is used to render the standardized advertising data using the advertising UI component. The jump module is used to respond to user interaction with the rendered advertisement. Through the advertisement UI component, it calls the advertisement interface service to perform unified interaction processing, so as to automatically complete the effect reporting and realize the jump by calling the native navigation API through the platform adapter.
9. An electronic device, wherein, The electronic device includes: A processor; and a memory storing computer-executable instructions, which, when executed, cause the processor to perform the method according to any one of claims 1-7.
10. A computer-readable storage medium, wherein, The computer-readable storage medium stores one or more programs that, when executed by a processor, implement the method of any one of claims 1-7.
Citation Information
Patent Citations
Rendering engine cross-applet platform running method and device, and storage medium
CN116225385A