Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của Ad Manager trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
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.
Chế độ hoạt động của SDK
SDK có thể hoạt động ở một hoặc nhiều chế độ, tuỳ thuộc vào phản hồi quảng cáo mà SDK đó nhận được từ quảng cáo
máy chủ.
Quảng cáo đơn lẻ
Một quảng cáo có thể phát bất cứ lúc nào khi start
tin nhắn sẽ được gửi tới IMAAdsManager. Không có hoạt động khởi tạo đặc biệt
để phát một quảng cáo.
Nhóm quảng cáo
Một số quảng cáo phát ngược lại khi thông báo start được gửi đến
IMAAdsManager. Không cần khởi tạo đặc biệt để
phát một nhóm quảng cáo.
Quy tắc quảng cáo
Danh sách phát các điểm chèn quảng cáo được lên lịch vào những thời điểm nhất định cho các điểm chèn quảng cáo
nội dung. Thông báo start sẽ bị bỏ qua trong chế độ quy tắc quảng cáo. Có thể
nhiều điểm chèn quảng cáo được lên lịch trong một danh sách phát (ví dụ: trước video,
giữa video, cuối video). Để biết thêm thông tin chi tiết về cách triển khai, hãy xem
phần Quy tắc quảng cáo bên dưới.
Quy tắc quảng cáo
IMA iOS
SDK hỗ trợ danh sách phát quảng cáo hoàn toàn tự động. Tính năng này
chèn điểm chèn quảng cáo vào nội dung như đã chỉ định trong
Google Ad Manager
khi quản lý quảng cáo. Công cụ này cũng đơn giản hoá đáng kể mã trình phát video
cần thiết để hỗ trợ các điểm chèn quảng cáo, bao gồm cả trước video, trong video và sau video.
Khi quản lý quảng cáo trong Ad Manager, bạn có thể chỉ định các quy tắc quảng cáo khác nhau
chẳng hạn như "luôn phát điểm chèn quảng cáo ở đầu nội dung" hoặc "phát một điểm chèn quảng cáo trong 1 phút
mỗi 30 phút nội dung".
Khi quảng cáo được yêu cầu, máy chủ quảng cáo có thể trả về một danh sách phát quảng cáo. SDK
xử lý danh sách phát và tự động lên lịch cho các điểm chèn quảng cáo đã
đã chỉ định.
Khi khởi tạo AdsManager, IMAContentPlayhead
được truyền vào qua initializeWithContentPlayhead:adsRenderingSettings:
. Nếu bạn đang sử dụng AVPlayer để hiển thị nội dung của mình, bạn sẽ truyền
bản sao IMAAVPlayerContentPlayhead vào SDK khi bạn tạo
adDisplayContainer Đối tượng này được dùng để theo dõi tiến trình phát nội dung quảng cáo
điểm chèn quảng cáo được tự động chèn tại thời điểm quy định trong Ad Manager.
Triển khai currentTime để trả về thời gian hiện tại của
trình phát video.
Thay đổi lệnh gọi khởi chạy IMAAdsManager thành
sử dụng initializeWithContentPlayhead:self.
IMAAdsManagerDelegate
được dùng để tạm dừng và tiếp tục nội dung khi các điểm chèn quảng cáo được phát.
Lưu ý: Khi nội dung đã phát xong, hoặc
người dùng đã dừng phát, hãy nhớ gọi contentComplete
trên IMAAdsLoader để báo hiệu cho SDK biết rằng nội dung
đã phát xong. Sau đó, SDK này sẽ phát điểm chèn quảng cáo sau video nếu đã được lên lịch.
Sự kiện ALL_ADS_COMPLETED sẽ được thực hiện khi tất cả các điểm chèn quảng cáo đều có
đã được phát. Ngoài ra, xin lưu ý rằng hoạt động theo dõi nội dung bắt đầu khi
initializeWithContentPlayhead:adsRenderingSettings của IMAAdsManager
được gọi và bạn phải luôn gọi initializeWithContentPlayhead:adsRenderingSettings
trước khi phát nội dung.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eThe Google IMA iOS SDK allows you to integrate ads into your video content using a WebView for ad requests, parsing, tracking, and rendering.\u003c/p\u003e\n"],["\u003cp\u003eIt supports three main operation modes: single ad, ad pod (multiple ads played back-to-back), and ad rules for scheduled ad breaks.\u003c/p\u003e\n"],["\u003cp\u003eAd rules simplify ad integration by automating ad playlist management based on Google Ad Manager settings, requiring an \u003ccode\u003eIMAContentPlayhead\u003c/code\u003e for content tracking.\u003c/p\u003e\n"],["\u003cp\u003eThe SDK utilizes the \u003ccode\u003eIMAAdsManagerDelegate\u003c/code\u003e to control content playback during ad breaks and requires signaling content completion via \u003ccode\u003econtentComplete\u003c/code\u003e for post-roll ads.\u003c/p\u003e\n"]]],[],null,["# Automate ad playlists\n\n| **Note:** The iOS SDK uses a WebView to load a JavaScript back end. This WebView is used to make ad requests, parse responses, ping tracking URLs, and render the ad UI.\n\nSDK operation modes\n-------------------\n\nThe SDK can operate in one or more modes, depending on the ad response it receives from the ad\nserver.\n\nSingle ad\n: An ad that can be played at any time when the `start`\n message is sent to the `IMAAdsManager`. No special initialization\n is necessary to play a single ad.\n:\n\nAd pod\n: Several ads that play back to back when the `start` message is sent to\n the `IMAAdsManager`. No special initialization is necessary to\n play a single ad pod.\n\nAd rules\n: A playlist of ad breaks scheduled at certain times against particular\n content. The `start` message is ignored in ad rules mode. There can\n be several ad breaks scheduled within a single playlist (e.g., pre-roll,\n mid-roll, post-roll). For further implementation details, see the\n [Ad Rules](#ad-rules) section below.\n\nAd rules\n--------\n\nIMA iOS\nSDK supports fully automated ad playlists. This feature\ninserts ad breaks into the content as specified in\n[Google Ad Manager](//admanager.google.com/)\nwhen trafficking your ads. It also greatly simplifies the video player code\nnecessary to support ad breaks, including pre-rolls, mid-rolls, and post-rolls.\n\n- When trafficking ads in Ad Manager, it is possible to specify various ad rules like \"always play ad break at the beginning of the content\" or \"play a one-minute ad break every 30 minutes of content\".\n- When ads are requested, the ad server can return an ad playlist. The SDK processes the playlist and automatically schedules the ad breaks that have been specified.\n- When initializing the `AdsManager`, an `IMAContentPlayhead` object is passed in via the `initializeWithContentPlayhead:adsRenderingSettings:` call. If you are using an AVPlayer to display your content, you pass an instance of `IMAAVPlayerContentPlayhead` to the SDK when you create your `adDisplayContainer`. This object is used to track the progress of the content playback so ad breaks are automatically inserted at the times specified in Ad Manager. \n\n **With AVPlayer:** \n\n ```objective-c\n IMAContentPlayhead *contentPlayhead =\n [[IMAAVPlayerContentPlayhead alloc] initWithAVPlayer:self.contentAVPlayer];\n IMAAdsRequest *request = [[IMAAdsRequest alloc] initWithAdTagUrl:adTagUrl\n adDisplayContainer:adDisplayContainer\n contentPlayhead:contentPlayhead\n userContext:nil];\n ```\n\n **Without AVPlayer:**\n 1. Implement the `IMAContentPlayhead` interface.\n 2. Implement `currentTime` to return the current time of your video player.\n 3. Change the `IMAAdsManager` initialization call to use `initializeWithContentPlayhead:self`.\n- The [IMAAdsManagerDelegate](/interactive-media-ads/docs/sdks/ios/client-side/reference/Protocols/IMAAdsManagerDelegate) is used to pause and resume the content as ad breaks are played.\n\n**Note:** When the content has finished playing or\nthe user has stopped playback, be sure to call `contentComplete`\non the `IMAAdsLoader` in order to signal to the SDK that the content\nhas finished playing. The SDK then plays the post-roll ad break, if one has been scheduled.\nThe `ALL_ADS_COMPLETED` event is raised when all ad breaks have\nbeen played. In addition, note that content tracking begins when\n`IMAAdsManager`'s `initializeWithContentPlayhead:adsRenderingSettings`\nmethod is called and you should always call `initializeWithContentPlayhead:adsRenderingSettings`\nbefore playing content."]]