// Instantiation
var visitor:Visitor = new Visitor("Visitor Nmespace"); // Provided by Adobe
// Configuration
visitor.trackingServer = "Visitor tracking server URL";
Instantiating the Visitor API component requires an input namespace parameter (provided in advance by Adobe). This is a pure string value.
There is only one configuration option available for the VisitorAPI component -- the URL of the back-end endpoint that provides the unique "label" for the current user.
// Instantiation var appMeasurementObject:AppMeasurement = new AppMeasurement(); appMeasurementObject.account = "Account name"; // Use the same namespace value you used for the Visitor API component. appMeasurementObject.visitorNamespace = "Visitor namespace"; // This is the Adobe Analytics endpoint appMeasurementObject.trackingServer = "Adobe Analytics tracking server URL"; // Attach the VisitorAPI to the AppMeasurement instance. appMeasurementObject.visitor = visitor;There are many configuration options available on the AppMeasurement instance that are not shown here. (See the Adobe Analytics Developer page for more configuration options.) The three options shown in the sample code above are required (account, visitorNamespace, trackingServer). These values are provided in advance by Adobe.
It is important to properly set up the dependency chain: the AppMeasurement instance aggregates (depends on) the Visitor API component.
It is the responsibility of the video player developer to implement and instantiate the IVideoHeartbeatPlayerDelegate interface. Once this implementation is in place, the instantiation process is very straightforward:
// Here, the CustomPlayerDelegate class implements the IVideoHeartbeatPlayerDelegate // interface. var playerDelegate:CustomPlayerDelegate = new CustomPlayerDelegate(); // We now have all required ingredients to instantiate the video heartbeat library. var videoHeartbeat:VideoHeartbeat = new VideoHeartbeat(appMeasurementObject, playerDelegate);
// Instantiate the configuration object. var heartbeatConfig:VideoHeartbeatConfigData = new VideoHeartbeatConfigData(); heartbeatConfig.playerName = "The name of your player app"; heartbeatConfig.trackingServer = "video heartbeat tracking server URL here"; heartbeatConfig.jobId = "Job-ID"; heartbeatConfig.publisher = "Publisher name"; heartbeatConfig.ovp = "The name of the online video platform (e.g., youtube)"; heartbeatConfig.sdk = "The version of your video player"; // Set debugLogging to "true" to activate debug tracing // Set debugLogging to "false" for deployment to the production environment heartbeatConfig.debugLogging = false; // (the default) // ==> Explicitly activate the video heartbeat functionality. <== heartbeatConfig.enableHeartbeat = true; videoHeartbeat.config(heartbeatConfig);