Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
NonceLoader
classpublic
Thư viện truy cập có lập trình cho phép nhà xuất bản thu thập các tín hiệu có thể dùng để mở khoá nhu cầu của AdX.
Nhà xuất bản nên tạo một NonceLoader khi tải trang để giảm độ trễ. Đối với mỗi luồng (cho DAI) hoặc yêu cầu quảng cáo riêng lẻ, hãy gọi các setter có liên quan khi cần, sau đó gọi loadNonceManager. Sau đó, nhà xuất bản có thể gọi NonceManager.getNonce() để lấy chuỗi cần thêm vào yêu cầu quảng cáo dưới dạng giá trị cho tham số URL "&paln". Sau đó, nhà xuất bản nên gọi NonceManager.sendAdClick() và NonceManager.sendAdImpression() khi thích hợp.
Hàm dựng
NonceLoader
new
NonceLoader(consentSettings)
Hàm khởi tạo.
Thông số
consentSettings
Không bắt buộc
Các chế độ cài đặt liên quan đến quy định và sự đồng ý.
Giá trị không được rỗng.
Phương thức
loadNonceManager
public
loadNonceManager(request) trả về Promise chứa NonceManager không rỗng
Yêu cầu chứa thông tin về số chỉ dùng một lần đang được yêu cầu.
Giá trị không được rỗng.
Giá trị trả về
non-null Promise containing non-null NonceManager Promise sẽ được phân giải sau khi NonceManager có nonce được mã hoá chứa tất cả thông tin trước giá thầu được cung cấp.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-21 UTC."],[[["\u003cp\u003eNonceLoader is a programmatic access library that enables publishers to gather signals for AdX demand.\u003c/p\u003e\n"],["\u003cp\u003ePublishers need to create a NonceLoader upon page load and utilize its methods to generate and manage nonces for ad requests.\u003c/p\u003e\n"],["\u003cp\u003eNonceManager provides methods for retrieving the nonce, which should be included in ad requests as the "&paln" URL parameter value, and for signaling ad clicks and impressions.\u003c/p\u003e\n"]]],["Publishers use the `NonceLoader` class to gather signals for unlocking AdX demand. On page load, a `NonceLoader` is created. For each stream or ad request, setters are invoked, followed by `loadNonceManager`. This method returns a `NonceManager` that yields a string, `getNonce()`, for the \"\\&paln\" URL parameter in ad requests. Subsequently, `NonceManager.sendAdClick()` and `NonceManager.sendAdImpression()` are called as needed. `loadNonceManager` requires a non-null `NonceRequest`. The `NonceLoader` constructor requires non-null `consentSettings`.\n"],null,["# Class: NonceLoader\n\nNonceLoader\n===========\n\nclass public\n\nThe programmatic access library allows publishers to collect signals that can\nbe used to unlock AdX demand.\nPublishers should create a NonceLoader on page load in order to reduce\nlatency. For each stream (for DAI) or individual ad request, call the\nrelevant setters as needed followed by a call to loadNonceManager. Publishers\ncan then call NonceManager.getNonce() in order to get the string that should\nbe added to ad requests as the value to the \"\\&paln\" URL parameter. Publishers\nshould then call NonceManager.sendAdClick() and\nNonceManager.sendAdImpression() as appropriate.\n\nConstructor\n-----------\n\n### NonceLoader\n\nnew\nNonceLoader(consentSettings)\n\nConstructor.\n\n| #### Parameter ||\n|-----------------|-------------------------------------------------------------------------------|\n| consentSettings | Optional Settings related to regulations and consent. Value must not be null. |\n\nMethod\n------\n\n### loadNonceManager\n\npublic\n\nloadNonceManager(request) returns Promise containing non-null [NonceManager](/ad-manager/pal/cast/reference/js/NonceManager)\n\n| #### Parameter ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| request | [NonceRequest](/ad-manager/pal/cast/reference/js/NonceRequest) The request containing information about the nonce being requested. Value must not be null. |\n\nReturns\n\n: `non-null Promise containing non-null `[NonceManager](/ad-manager/pal/cast/reference/js/NonceManager) The promise that will be resolved once the NonceManager with an encrypted nonce containing all pre-bid information is available."]]