AdobeDocs / experience-platform.en

MIT License
7 stars 110 forks source link

Suggested alternative to trackEvent solution for WebSDK #345

Closed ryrob30 closed 6 months ago

ryrob30 commented 6 months ago

Issue in ./help/web-sdk/personalization/adobe-target/web-sdk-atjs-comparison.md

In the track event section the document suggestions for Web SDK are quite lengthy and make it look like something that was super simple in at.js world now requires many lines of code and logic. Here's a alternative I'd suggest we document: https://adobe-acs.slack.com/archives/C0ERPN55W/p1713895648256759

The exisiting option relies on requesting content from Target, then checking to see if content is returned before sending the "track event" equivalent call. However, there are many (if not more) valid use cases where a customer would like a track event fired not because they just saw Target content, but because they performed some action that may be used in activity conversion events (e.g., click a button). This solution better accommodates that scenario.

In case you don't have access to the Slack linked aboved, here's the sample code for an mbox/location named "dataCapture". Any custom params could be added via the __adobe.target data object like listed else where on the page:

//replicates an at.js trackEvent call
alloy("sendEvent", {
    "type": "decisioning.propositionDisplay",
    "xdm": {
        "_experience": {
            "decisioning": {
                "propositions": [{
                    "scope": "dataCapture"
                }]
            }
        }
    }
});
vfalon commented 6 months ago

Thank you for submitting this issue. We will review the documentation and make the necessary updates as quickly as possible. Tracking internally in PLAT-192335.

vfalon commented 6 months ago

Added the new sample to the docs. Closing this issue.