Expand my Community achievements bar.

s.apl in adobe analytics implementation vs Web SDK

Avatar

Level 4

Hi all, in the existing adobe set up we use the s.apl plugin to populate s.events. It is very handy as you put conditional statements and its easy to structure the events. In Web SDK, it seems like, we have to set each every single event separately and attach conditional statement for each event. Example below.

 

Question - does anyone have a way to replicate the same s.apl functionality in Web SDK set up ? Thank you.

 

function anon() {
  var events = s.events;
  try {
    if (window.dataLayer.instruction) {
      var reference = Bootstrapper.data.resolve(60351);
      var timeTaken = Bootstrapper.data.resolve(60382);
      var instructionType = Bootstrapper.data.resolve(67045);
      events = s.apl(events, "purchase", ",", 1);

      if (timeTaken > 0)
        events = s.apl(
          events,
          "event108=" + timeTaken + ":" + reference,
          ",",
          1
        );
      switch (instructionType) {
        case "add_cash":
          events = s.apl(events, "event75=1:" + reference, ",", 1);
          events = s.apl(events, "event88:" + reference, ",", 1);
          break;
        case "withdraw_cash":
          events = s.apl(events, "event76:" + reference, ",", 1);
          events = s.apl(events, "event77:" + reference, ",", 1);
          break;
        default:
          break;
      }
    }
  } catch (e) {}
  return events || "";
}

 

vs 

 

xdm._experience.analytics.event101to200.event108.id = 

if (window._dl.instruction) {
  var reference = Bootstrapper.data.resolve(60352);
  var timeTaken = Bootstrapper.data.resolve(60389);
  var instructionType = Bootstrapper.data.resolve(67043);

  if (timeTaken > 0)
    events = s.apl(
      events,
      "event108=" + timeTaken + ":" + reference,
      ",",
      1
    );
  }

// Above needs to be done very single event 

 

0 Replies