Target "trackEvent()" equivalent for Alloy? | Community
Skip to main content
Level 2
February 18, 2022
Solved

Target "trackEvent()" equivalent for Alloy?

  • February 18, 2022
  • 1 reply
  • 1767 views

Greetings!

I'm currently testing the Web SDK (Alloy) to handle everything related to Target.
Most of my activities are written form based and currently I'm struggling to find something similar to the old school "adobe.target.trackEvent()" function to count e.g. simple clicks of a button.

Normally I would write something like this:

 

adobe.target.trackEvent({ "mbox": "click-mbox" });

 

How would i write the same via Alloy?
I found this in the documentation (https://experienceleague.adobe.com/docs/experience-platform/edge/personalization/adobe-target/web-sdk-atjs-comparison.html%3Flang%3Dit#how-to-track-events), but to be honest I don't really get it.

I understand that we are now using

 

alloy("sendEvent", { … });

 

but i couldn't figure out where to pass the "click-mbox" value.

Am I missing something? Thank you in advance! 🙂

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gokul_Agiwal

Hi @christopherha14 

As per example above "click-mbox" is the mbox name. 

 

When you're using the WebSDK, you can use 

  • decisionScopes: which retrieve specific activities (useful for activities created with the form-based composer) by adding this option to your events.

if you look at the terminology, 

Scope: The scope of the decision. In Target, the scope is the mBox. The global mBox is the __view__ scope.

So in your above example you can add mbox name like below. 

 

 

alloy("sendEvent", { renderDecisions: true, xdm: { ...}, decisionScopes: ["click-mbox"] });

 

 Hope this helps. 

1 reply

Gokul_Agiwal
Community Advisor
Gokul_AgiwalCommunity AdvisorAccepted solution
Community Advisor
February 20, 2022

Hi @christopherha14 

As per example above "click-mbox" is the mbox name. 

 

When you're using the WebSDK, you can use 

  • decisionScopes: which retrieve specific activities (useful for activities created with the form-based composer) by adding this option to your events.

if you look at the terminology, 

Scope: The scope of the decision. In Target, the scope is the mBox. The global mBox is the __view__ scope.

So in your above example you can add mbox name like below. 

 

 

alloy("sendEvent", { renderDecisions: true, xdm: { ...}, decisionScopes: ["click-mbox"] });

 

 Hope this helps. 

Level 2
February 28, 2022

Hi @gokul_agiwal,

thank you very much for your quick reply! I'll take a closer look at the whole thing in the next few days but for now it seems to be working. Thank you for the informations! 🙂

Have a nice day and all the best.

Gokul_Agiwal
Community Advisor
Community Advisor
February 28, 2022

Hi @christopherha14 

Glad to know that its working. Have a great day and happy targeting  😀