TrackingCondition
open class TrackingCondition
extension TrackingCondition: ViewCondition
View condition with minimum percentage and minimum visible duration that can be used for view analytics
- Success will be called when minimum view percentage condition fails after a previous success and the total duration for which the minimum view percentage condition was satisfied is greater than minimum specified duration
-
Initializes
TrackingCondition
with provided minimum view percentage and minimum visible durationDeclaration
Swift
public init(minPercentage: Float, minDuration: Int)
Parameters
minPercentage
Minimum percentage of the view that needs to be visible to satisfy the condition
- Ranges from 0 - 100
minDuration
Duration in milliseconds for which minimum view percentage should be satisfied to satisfy the condition
-
Called when the condition is met (satisfied)
Subclasses should perform tasks that need to be done after condition is satisfied here
Important
This method needs to be overridden in subclasses, else it will throw a fatal error
Note
This method is always called on the main thread
Declaration
Swift
open func conditionMet(startTime: TimeInterval, visibleDuration: Int, maxPercentage: Float)
Parameters
startTime
The timestamp when minimum percentage condition was first satisfied
visibleDuration
The total duration for which minimum percentage condition was satisfied
maxPercentage
The maximum visible percentage of the view in the visible duration
-
Called when the minimum percentage condition is first satisfied
Subclasses should perform tasks that need to be done once viewability starts here
Important
This method needs to be overridden in subclasses, else it will throw a fatal error
Note
This method is always called on the main thread
Declaration
Swift
open func viewabilityStarted()
-
Called when the minimum percentage condition fails after a previous success
Subclasses should perform tasks that need to be done once viewability ends here
Important
This method needs to be overridden in subclasses, else it will throw a fatal error
Note
This method is always called on the main thread
Declaration
Swift
open func viewabilityEnded(startTime: TimeInterval, duration: TimeInterval, maxPercentage: Float)
-
Declaration
Swift
public func evaluate(for state: ScrollState, viewPercentage: Float)
-
Declaration
Swift
public func reset()