Autheos

The Autheos class is the base of the embed code. If you don’t want to use our UI components, this class is all you need.

Autheos (constructor)#

new Autheos();

Arguments#

None that we currently support. This is subject to change in a future version of the embed code.

Autheos.getVideos#

The core function to retrieve videos based on a query. Returns a promise that resolves with a new context. Multiple function calls will be automatically batched into a single HTTP request to improve performance.

If you want to embed videos with a popup automatically, take a look at the AutheosUI component.

getVideos(query);

Arguments#

Returns#

Returns a promise that resolves with a new context after the request completes.

Example#

const instance = new Autheos();
instance.getVideos({
  ean: '1234567890123'
}).then((ctx) => {
  // Do something with ctx.videos
});

Autheos.trackEvent#

Tracks a custom event. Useful to measure user engagement and impact on conversion.

trackEvent(ctx, eventType, [eventData]);

Arguments#

  • ctx (Object): A context object returned by Autheos.getVideos. Used to identify for what video request this event is relevant.
  • eventType (String) Name of the event.
  • eventData (Object) Optional metadata to send along with the event.

Returns#

Returns a promise that resolves after the event was successfully tracked.

Autheos.attachTracker#

Attach a click listener to the specified target element to automatically track click events for the specified context.

attachTracker(ctx, eventType, target);

Arguments#

  • ctx (Object): A context object returned by Autheos.getVideos. Used to identify for what video request this event is relevant.
  • eventType (String) Name of the event.
  • target (Object) The node to attach an event tracker to. This can be a HTML element, a CSS selector, or an array of either.

Returns#

Returns the HTML elements that now have event trackers attached to them.

Autheos.attachAddToCartTracker#

Convenience wrapper to attach an add-to-cart event tracker. Simply calls Autheos.attachTracker with add-to-cart as event type.

attachAddToCartTracker(ctx, target);

Arguments#

  • ctx (Object): A context object returned by Autheos.getVideos. Used to identify for what video request this event is relevant.
  • target (Object) The node to attach an event tracker to. This can be a HTML element, a CSS selector, or an array of either.

Returns#

Returns the HTML elements that now have event trackers attached to them.

Example#

const instance = new Autheos();
instance.getVideos({
  ean: '1234567890123'
}).then((ctx) => {
  // Replace `#your-add-to-cart-button` with your own selector.
  instance.attachAddToCartTracker(ctx, '#your-add-to-cart-button');
});