Adobe Implementation Playbook

Skills

Skill used throughout the build

JavaScript for Adobe — Tags (Launch) & Web SDK

Tags runs on JavaScript. Custom-code data elements, rule conditions, direct-call rules and Web SDK sendEvent calls all need it, and debugging a broken beacon means reading JS in the browser console.

0 of 0 done

Modules

Module 1

Variables, types & objects

Concept
const for values that don’t change, let for ones that do. Objects group related data — the data layer is one big object.
Where it's used
Reading values from the data layer.
const page = window.digitalData.page;
let pageName = page.pageName;
console.log(typeof pageName); // "string"

Practice: In your browser console, read 3 values from a site’s data layer.

Console output
Screenshot Console outputAdd screenshots/javascript/module-01.png
Module 2

Safe data-layer access

Concept
Missing objects throw errors. Optional chaining (?.) and a default (??) keep the tag from breaking.
Where it's used
Custom-code data elements that never return undefined.
return window.digitalData?.page?.pageName
    ?? "unknown page";

Practice: Rewrite a data element so it returns "unknown" when the data layer is missing.

Data element returning fallback value
Screenshot Data element returning fallback valueAdd screenshots/javascript/module-02.png
Module 3

Functions & conditionals

Concept
Functions package reusable logic; if/else and the ternary operator pick values.
Where it's used
Rule conditions such as “only on checkout pages”.
function pageType(path) {
  if (path.startsWith("/checkout")) return "checkout";
  return path === "/" ? "home" : "content";
}
return pageType(location.pathname);

Practice: Write a function that returns a page type for 4 kinds of URL.

Function tested in console
Screenshot Function tested in consoleAdd screenshots/javascript/module-03.png
Module 4

Arrays & loops

Concept
Arrays hold lists; map() transforms each item; filter() keeps matches; forEach() loops.
Where it's used
Turning a cart array into XDM productListItems.
const items = digitalData.cart.items;
return items.map(i => ({
  SKU: i.sku,
  quantity: i.qty,
  priceTotal: i.price * i.qty
}));

Practice: Convert a 3-item cart into productListItems.

Data element output in Debugger
Screenshot Data element output in DebuggerAdd screenshots/javascript/module-04.png
Module 5

DOM & events

Concept
querySelector finds elements; addEventListener reacts to clicks and form submits.
Where it's used
Understanding what a Tags click rule does for you.
document.querySelector("#add-to-cart")
  .addEventListener("click", () => {
    console.log("add to cart clicked");
  });

Practice: Log a message when a specific button is clicked on a test page.

Console showing the click log
Screenshot Console showing the click logAdd screenshots/javascript/module-05.png
Module 6

Tags helpers (_satellite)

Concept
_satellite.getVar reads a data element; _satellite.track fires a direct-call rule; _satellite.logger logs in debug mode.
Where it's used
Custom code inside Tags rules and debugging in production.
const name = _satellite.getVar("page name");
_satellite.logger.log("Page:", name);
_satellite.track("cart_add");
/ _satellite.setDebug(true) in console

Practice: Create a direct-call rule "cart_add" and fire it from the console.

Rule firing in debug output
Screenshot Rule firing in debug outputAdd screenshots/javascript/module-06.png
Module 7

Web SDK sendEvent

Concept
The Web SDK command alloy("sendEvent") sends an XDM payload to the Edge Network and returns a Promise.
Where it's used
What the Tags “Send event” action does behind the scenes.
alloy("sendEvent", {
  xdm: {
    eventType: "commerce.productListAdds",
    commerce: { productListAdds: { value: 1 } }
  }
}).then(result => console.log(result));

Practice: Inspect a sendEvent call in Assurance and match it to your schema.

Assurance event detail
Screenshot Assurance event detailAdd screenshots/javascript/module-07.png
Module 8

Debugging

Concept
Console errors, breakpoints in DevTools, the Experience Platform Debugger and Assurance show what actually fired.
Where it's used
QA before every publish.
// In the console
_satellite.setDebug(true);
/ reload page, then filter the console by "satellite"
/ Network tab: filter "interact" for Edge calls

Practice: Find and fix one broken data element on a test property.

Debugger showing the corrected value
Screenshot Debugger showing the corrected valueAdd screenshots/javascript/module-08.png

Must know

  • Tags is JavaScript underneath: custom code data elements, conditions and actions are all JS.
  • Read the data layer safely (check objects exist) so one missing value does not break every rule.
  • _satellite.getVar(), _satellite.setVar() and _satellite.track() are the main Tags helpers.
  • Web SDK is called with alloy("sendEvent", { xdm: {...} }).
  • Debug in the browser console and network tab before blaming Adobe.

Interview questions

From your board. Answer out loud before you reveal.

let vs const vs var?

const can’t be reassigned, let can; both are block-scoped. var is function-scoped and older — avoid it in new code.

== vs ===?

=== compares value and type with no conversion; == converts types first. Use === to avoid surprises like "1" == 1.

How do you stop a data element from throwing an error?

Use optional chaining and a default (?. and ??), or a try/catch, so missing data returns a safe fallback.

What is a Promise?

An object for a result that arrives later. alloy("sendEvent") returns one; use .then() or await to handle the response.

When would you use a direct-call rule?

When the site needs to trigger tracking explicitly from code (e.g. an SPA view change) with _satellite.track("name").

How do you debug a beacon that isn’t firing?

Enable _satellite.setDebug(true), check the rule’s conditions and consent, look for console errors, and confirm the call in the Network tab or Assurance.

Key terms and sources

TermWhat it is
_satellite objectTags client-side helpers.
_satellite.track()Triggering direct call rules.
_satellite.setVar()Setting custom variables.
sendEventThe Web SDK command.
Web SDK action typesActions available in the Web SDK extension.