Methods related to Script Mode analytics events. This is an advanced interface for use by web apps that do not use the plugin’s HTML rendering.
Members
-
<readonly> kind :string
-
These are the event kinds that are recognized by
API.event#track
.Type:
- string
Properties:
Name Type Default Description AD_REQUEST
string ad-request Ad request. This event is automatically tracked when the ad request has been dispatched
AD_RESPONSE
string ad-response Ad response. This event is automatically tracked when the ad response is received from the ad server, with a property of response status
IMPRESSION
string impression Ad impression. This event is automatically tracked when requestAd completes successfully. A pixel tracker may be added to the DOM.
COLLECTION_IMPRESSION
string collection-impression Collection impression. This event is automatically tracked when requestAd completes successfully. A pixel tracker may be added to the DOM.
IMPRESSION_FAILED
string impression-failed Impression Failed. This event is emitted when requestAd fails.
PRIMARY_CLICK
string primary-click Primary click event. Track this event when an ad is clicked. A pixel tracker image may be added to the DOM’s body element. Make sure you do not delete it.
SECONDARY_VIEW
string secondary-view Secondary page view event. Track this event when an article is displayed on screen as a result of an ad click. Do not use this event if the click came from a different web site. It is for internal links only.
DEEP_LINK
string deep-link Deep link page view event. Track this event when an article is displayed on screen as a result of a deep link from another web site.
INBOUND_VIEW
string inbound-view Inbound page view event. Track this event when an article is hosted on the CMS of the web site and is not served by MediaVoice.
CTA_CLICK
string cta-click Call-to-Action click event. Track this event when a CTA link is clicked.
CTA links can be identified by a containing SPAN or DIV with the
nativeads-cta
CSS class. This container will have adata-cta
attribute whose value MUST be used as thectaID
value when tracking the event.OPERATIONAL_CLICK
string operational-click Operational click event. Track this event when a hyperlink of an operational nature displayed within an ad experience has been clicked (or swiped) by a user.
Methods
-
track(options)
-
Track an event for analytics collection.
Parameters:
Name Type Description options
object Event options
Properties
Name Type Argument Description kind
API.event#kind The kind of event to track. Example:
"primary-click"
unit
object <optional>
Ad unit
model
object <optional>
The Article model. Used for Deep-linking and MOAT tracking.
adtag
object <optional>
Ad tag
label
string <optional>
Event label
href
string <optional>
The page URL to track. By default,
window.location.href
will be used.htmlElement
object <optional>
The HTML element or [jQuery][1] object that contains the ad preview. This is required for MOAT tracking with the
"impression"
event. The element must be rendered and in the DOM. [1]: http://jquery.com/ctaID
string <optional>
The ID of the Call-to-Action (CTA). This is required by the
"cta-click"
event.adResponseStatus
string <optional>
The ad response status for the ad request. This is required by the
"ad-response"
event.adResponseTime
string <optional>
The time spent for an ad-request. This is required by the
"ad-response"
event.promoFeedID
string <optional>
The id of the promo feed from which a deep link page view event resulted from. This is only relevant when the event
kind
is a"deep-link"
.incomingPropertyID
string <optional>
The property ID of the traffic referrer. This is only relevant when the event
kind
is a"deep-link"
. Only use this when both the referring property and current property are owned by the same MediaVoice Organization.incomingPropertyLabel
string <optional>
The placement label of the traffic referrer. This is only relevant when the event
kind
is a"deep-link"
. Only use this when both the referring property and current property are owned by the same MediaVoice Organization.error
Error <optional>
An Error instance indicating the error that occurred. Should be supplied with all 'impression-failed' events.