Expand my Community achievements bar.

SOLVED

Target "trackEvent()" equivalent for Alloy?

Avatar

Level 2

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-sd...), 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!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @chrish75788707 

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. 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @chrish75788707 

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. 

Avatar

Level 2

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.

Avatar

Community Advisor

Hi @chrish75788707 

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

Avatar

Level 1

Hi @Gokul_Agiwal ,

 

i have used the same code but when I check my target report the conversion data is still showing as 0.

 

I have configured the goal metric as conversion - viewed an mbox 

 

please help me!