Using the Last Event Service JavaScript Library with Adobe Experience Platform Web SDK

Advertisers with an Adobe Advertising-Adobe Analytics Integration Only

If your organization uses the legacy Adobe Analytics visitorAPI.js library for data collection, you can optionally switch to using the Adobe Experience Platform Web SDK library (alloy.js), which allows you to interact with the various Experience Cloud services through the Edge Network.

The Analytics for Advertising Last Event Service JavaScript library, as-is, records view-through and click-through events and stitches them to the associated conversions using a supplemental ID (SDID). The Web SDK library, however, doesn’t supply a stitch ID. To use the Web SDK for Analytics for Advertising, you must modify 1) the Last Event Service tag you use on your webpages and 2) your Web SDK sendEvent commands accordingly.

Step 1: Edit Your Last Event Service Tag to Generate a StitchID

In the Analytics for Advertising Last Event Service tag you use on your webpages, add code to generate the StitchID using the random ID generator that’s bundled in the library.

Legacy tag:

<script>
     if("undefined" != typeof AdCloudEvent)
          AdCloudEvent('IMS ORG Id','rsid');
</script>

New tag:

<script>
     if("undefined" != typeof AdCloudEvent)
          stitchId = AdCloudEvent('IMS ORG Id','rsid').generateRandomId();
</script>

Step 2: Use Web SDK to Send the StitchID as XDM Data for Analytics

Insert the following property within your Web SDK sendEvent command to send the StitchID to Experience Edge as Experience Data Model (XDM) data for Analytics. Analytics uses the value as an SDID.

Property to add:

     "_adcloud": {
       "advertisingStitchID": stitchId
     }

Example:

<script>
  alloy("sendEvent", {
    "xdm": {
      "commerce": {
        "order": {
                ………
        }
     },
     "_adcloud": {
       "advertisingStitchID": stitchId
     }
    }
  });
</script>
recommendation-more-help
fbbdcc36-f208-41e5-b715-a077abaec5c3