ProgrammaticAccessLibrary Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
PALNonceManager
@interface PALNonceManager : NSObject
Manages a nonce and its event reporting for a single content playback session.
The below content playback session lifecycle methods must be accurately called in order to enable
programmatic monetization.
-
The nonce generated for this manager when it was loaded.
This value will never change for a given PALNonceManager
instance.
This nonce value is only valid for a single content playback session up to a maximum duration of
6 hours.
Declaration
Swift
var nonce: String { get }
Objective-C
@property (nonatomic, copy, readonly, nonnull) NSString *nonce;
-
A gesture recognizer that must be attached to each view each ad is displayed in during playback.
Attach this gesture recognizer through UIView
‘s addGestureRecognizer
:
method. Once the ad is complete, the gesture recognizer may be removed with
removeGestureRecognizer
: and added to another one if the view is not the same.
This recognizer does not trigger any network requests.
Declaration
Swift
var gestureRecognizer: UIGestureRecognizer { get }
Objective-C
@property (nonatomic, readonly, nonnull) UIGestureRecognizer *gestureRecognizer;
-
Notifies Google ad servers that a clickthrough on an ad has occurred during the given content
playback session.
Declaration
Objective-C
- (void)sendAdClick;
-
Notifies Google ad servers that playback for the given content playback session has started. This
should be called on “video player start”. This may be in response to a user-initiated action
(click-to-play) or an app initiated action (autoplay).
This method will start asynchronous calls to Google servers to collect signals needed for IVT
monitoring and detection.
Declaration
Swift
func sendPlaybackStart()
Objective-C
- (void)sendPlaybackStart;
-
Notifies Google ad servers that playback for the given content playback session has ended. This
should be called when playback ends (for example, when the player reaches end of stream, or when
the user exits playback mid-way, or when the user quits the app).
This method ends the asynchronous calls to Google servers started in sendPlaybackStart
.
Declaration
Swift
func sendPlaybackEnd()
Objective-C
- (void)sendPlaybackEnd;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003ePALNonceManager\u003c/code\u003e manages a nonce and its event reporting for a single content playback session, requiring accurate lifecycle method calls for programmatic monetization.\u003c/p\u003e\n"],["\u003cp\u003eIt provides a nonce valid for a single session (up to 6 hours) and a gesture recognizer to attach to ad views for tracking.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers must notify Google ad servers about key events like ad clicks, playback start, and playback end using the provided methods.\u003c/p\u003e\n"]]],["The `PALNonceManager` manages a nonce for a single content playback session, valid for up to 6 hours. It provides a `nonce` string and a `gestureRecognizer` to be added to ad views. It also offers methods: `sendPlaybackStart` to notify Google servers of playback initiation, triggering asynchronous server calls; `sendAdClick` to register ad clickthroughs; and `sendPlaybackEnd` to signal the end of playback, concluding the server calls.\n"],null,["# ProgrammaticAccessLibrary Framework Reference\n\nPALNonceManager\n===============\n\n\n @interface PALNonceManager : NSObject\n\nManages a nonce and its event reporting for a single content playback session.\n\nThe below content playback session lifecycle methods must be accurately called in order to enable\nprogrammatic monetization.\n- `\n ``\n ``\n `\n\n ### [nonce](#/c:objc(cs)PALNonceManager(py)nonce)\n\n `\n ` \n The nonce generated for this manager when it was loaded.\n\n This value will never change for a given `PALNonceManager` instance.\n This nonce value is only valid for a single content playback session up to a maximum duration of\n 6 hours. \n\n #### Declaration\n\n Swift \n\n var nonce: String { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nonnull) NSString *nonce;\n\n- `\n ``\n ``\n `\n\n ### [gestureRecognizer](#/c:objc(cs)PALNonceManager(py)gestureRecognizer)\n\n `\n ` \n A gesture recognizer that must be attached to each view each ad is displayed in during playback.\n\n Attach this gesture recognizer through `UIView`'s `addGestureRecognizer`:\n method. Once the ad is complete, the gesture recognizer may be removed with\n `removeGestureRecognizer`: and added to another one if the view is not the same.\n This recognizer does not trigger any network requests. \n\n #### Declaration\n\n Swift \n\n var gestureRecognizer: UIGestureRecognizer { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) UIGestureRecognizer *gestureRecognizer;\n\n- `\n ``\n ``\n `\n\n ### [-sendAdClick](#/c:objc(cs)PALNonceManager(im)sendAdClick)\n\n `\n ` \n Notifies Google ad servers that a clickthrough on an ad has occurred during the given content\n playback session. \n\n #### Declaration\n\n Swift \n\n func sendAdClick()\n\n Objective-C \n\n - (void)sendAdClick;\n\n- `\n ``\n ``\n `\n\n ### [-sendPlaybackStart](#/c:objc(cs)PALNonceManager(im)sendPlaybackStart)\n\n `\n ` \n Notifies Google ad servers that playback for the given content playback session has started. This\n should be called on \"video player start\". This may be in response to a user-initiated action\n (click-to-play) or an app initiated action (autoplay).\n\n This method will start asynchronous calls to Google servers to collect signals needed for IVT\n monitoring and detection. \n\n #### Declaration\n\n Swift \n\n func sendPlaybackStart()\n\n Objective-C \n\n - (void)sendPlaybackStart;\n\n- `\n ``\n ``\n `\n\n ### [-sendPlaybackEnd](#/c:objc(cs)PALNonceManager(im)sendPlaybackEnd)\n\n `\n ` \n Notifies Google ad servers that playback for the given content playback session has ended. This\n should be called when playback ends (for example, when the player reaches end of stream, or when\n the user exits playback mid-way, or when the user quits the app).\n\n This method ends the asynchronous calls to Google servers started in `sendPlaybackStart`. \n\n #### Declaration\n\n Swift \n\n func sendPlaybackEnd()\n\n Objective-C \n\n - (void)sendPlaybackEnd;"]]