Install the Web SDK using the NPM package
Adobe Experience Platform Web SDK is available as an NPM package. Installing the NPM package allows you to have control of the build process for the Adobe Experience Platform Web SDK JavaScript library. The NPM package exposes EcmaScript version 5 modules or EcmaScript version 2015 (ES6) modules meant to be run in the browser.
npm install @adobe/alloy
The NPM package of the Adobe Experience Platform Web SDK exposes a createInstance
function. The name option passed to the function controls the prefix used in logging. Below are examples of using the package.
Using the package as an ECMAScript 2015 (ES6) module
import { createInstance } from "@adobe/alloy";
const alloy = createInstance({ name: "alloy" });
alloy("config", { ... });
alloy("sendEvent", { ... });
NOTE
Using the package as an ECMAScript 5 module
var alloyLibrary = require("@adobe/alloy");
var alloy = alloyLibrary.createInstance({ name: "alloy" });
alloy("config", { ... });
alloy("sendEvent", { ... });
recommendation-more-help
ad108910-6329-42f1-aa1d-5920a2b13636