Public Events - ads-ep/EpJs GitHub Wiki

Available Events

Event Name Format Example Description
FMC:RECEIVE_APPLICATION_RESULT ApplicationResult
FMC:VIEW_PAGE {pageName: string} {"pageName": "prescreen/offer"}
FMC:TIMEOUT_DSP {} {}
FMC:TIMEOUT_APPLICATION {} {}
FMC:SUBMIT_PRESCREEN_APPLICATION {} {}
FMC:SUBMIT_APPLICATION {} {}
FMC:OFFER_DECLINE {} {}
FMC:CANCEL_APPLICATION {} {}
FMC:APPLICATION_COMPLETED {} {}
FMC:ADD_TO_WALLET {} {}
FMC:OFFER_RESPONSE
FMC:OFFER_RESPONSE OfferResponseType "YES"
FMC:OFFER_RESPONSE OfferResponseType "NO"
FMC:OFFER_RESPONSE OfferResponseType "NOT_ME"
FMC:OFFER_RESPONSE OfferResponseType "ABANDONED"
FMC:OFFER_RESPONSE OfferResponseType "PRESCREEN_NO"
EPJS:CLOSE_OVERLAY {dismissTarget?: HTMLDivElement} {}
EPJS:SHOW_OVERLAY {} {}
event:ready
event:placements-generated

Models

OfferResponseType

enum OfferResponseType {
  Yes = 'YES',
  No = 'NO',
  NotMe = 'NOT_ME',
  Abandoned = 'ABANDONED',
  PrescreenNo = 'PRESCREEN_NO',
}

Application Result

interface ApplicationResult {
  result: ApplicationResultType;
  callId: string | null;
  status: number;
  message: string;
}
enum ApplicationResultType {
  Approved = 'APPROVED',
  Pending = 'PENDING',
  AccountExists = 'ACCOUNT_EXISTS',
  Error = 'ERROR',
}

Examples

Listen to specific events

EpJs.on('FMC:RECEIVE_APPLICATION_RESULT', function(applicationResult){
  // Handle Application Result
  switch(applicationResult.result){
    case 'APPROVED':
      // Handle approved case
      break;

    case 'PENDING':
      // Handle pending case
      break;

    case 'ACCOUNT_EXISTS':
      // Handle account exists case
      break;

    case 'ERROR':
      // Handle error case
      break;
  }
});

Listen to events using wildcard

EpJs.on('event:*', function(){
    console.log(this.event);
});
// Output:
// event:ready
// event:placements-generated

EpJs.on('FMC:*', function(data){
  console.log(this.event, data); 
// Output:
// FMC:VIEW_PAGE {pageName: "prescreen/offer"}
});

EpJs.on('EPJS:*', function(data){
  console.log(this.event, data);
});