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
Views
Replies
Total Likes
To be honest, I don't bother with most of the plugins, I just append using simple JS (I am using App Measurement currently).
In AppMeasurement, I just do:
s.events = s.events ? s.events + ",event1=" + someVariable : "event1=" + someVariable;
Basically, this is a short form IF Statement... I check if s.events is populated with anything, if it is, then I take the existing value of s.events and add my delimiter (,) and the new event I want to push (adding the numeric value if needed, or just a simple ",event1" if not)... and if there is no event data, then I just set s.events to my event (without the delimiter)
So instead of using a plugin, can you not use a similar simple JS function to append the values together?
If the shortform notation is confusing, you can break it out into a long form IF statement, which I can see you are already familiar with as per your example.
Views
Replies
Total Likes
@Jennifer_Dungan what about the Web SDK ? There are plenty of options in the appMeasurement, but it seems like in the web sdk we have to set each event separately. ie, you can't simply append and return one events variable.
No, you're right.. I thought that maybe you were trying to use the append to concatenate the serialization values... and that you wanted a literal "event108" as part of that serialization....
No, as far as I am aware, all events do have to be set separately... the s.apl can be used to append any values technically... since you had the
xdm._experience.analytics.event101to200.event108.id
I figured this was already there..
So, are you asking how to create an appended event list in WebSDK, rather than setting the events into the schema?
First off, do you have any needs or plans to use CJA in the future? Because if you are just switching your technology to use WebSDK, but don't actually need the proper SDK Schema, there is the option to send data as is, in Analytics format, using the "analytics" field group.
https://www.youtube.com/watch?v=D9eouvCtNRU
You can continue to send all your data with the "prop1", "eVar1", "events", etc designations... and these will be automatically mapped to your analytics instance.
Views
Replies
Total Likes
Apologies, mistake in the code. Can't edit the post for some strange reason.
xdm._experience.analytics.event101to200.event108.id = (function anon() {
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) return timeTaken + ":" + reference;
}
})();
Ah, ok, I was wondering about some of the original code, lol
Thanks for the update.
Views
Replies
Total Likes
Hi @Franc_G
you can download the source of the plugin here https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/plugins/apl
and with a tiny adjustment adapt it to e.g. work on your _satellite instance.
I typically do that in a library loaded event custom code.
Instead of function apl, just do a _satellite.apl = function ... (essentially paste the whole block).
and use _satellite.apl() instead of s.apl()
works like a charm
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies