I recently implemented a custom script for Adobe Target using the trackEvent API, despite using the Web SDK for my setup. Surprisingly, the script is working, and the trackEvent is successfully passing parameters to Adobe Target. I would like to understand why this is happening, given that sendEvent is the recommended method for Web SDK.
Here is the script I used:
<script> const osTheme = window.matchMedia("(prefers-color-scheme: dark)"); if (osTheme.matches) { adobe.target.trackEvent({ "mbox": "themePreference", "params": { "userTheme": "dark" } }); } else { adobe.target.trackEvent({ "mbox": "themePreference", "params": { "userTheme": "light" } }); } </script>
What I Observed:
{ "eventType": "decisioning.propositionDisplay", "_experience": { "decisioning": { "propositions": [ {"scope": "themePreference"} ], "propositionEventType": { "display": 1 } } }, "data": { "__adobe": { "target": { "userTheme": "dark" } } } }
My Questions:
Additional Information:
Thank you for your assistance in clarifying this behavior and guiding me on the best practices moving forward!
조회 수
답글
좋아요 수
Hi @mahai ,
조회 수
답글
좋아요 수
@mahai it seems you are not implementing track events using Target Extention via Adobe launce rather directly using custom script, I suggest moving the script to Target Extention implementation.
조회 수
답글
좋아요 수
Thank you, @RiteshY18. That's partially correct. We are indeed using the Web SDK extension.
What actually happened was that trackEvents was working because we were using a script in Launch that converted trackEvents to sendEvents. This was undocumented, hence my confusion.
조회 수
답글
좋아요 수
@mahai suggest to use target extension then provided event rather webSDK events
조회 수
답글
좋아요 수