Expand my Community achievements bar.

SOLVED

How can I replicate the trackEvent from at.js behaviour with webSDK?

Avatar

Level 2

Hello community, 

 

I´ve recently moved an adobe target setup to webSDK but one feature i´m struggling to replicate in webSDK. 

 

In at.js I had some custom goals deployed with the function trackEvent and I used that as conversion goals for some activities (viewed an mbox). But in webSDK I´m not finding out how to do the same thing. I have reviewed documentation and found that I need to send a normal alloy("sendEvent) request with some options but that does not work in my case or I´m not doing it right. Also I found the documentation quite ambiguous in this aspect. 

 

How can I deploy the same event tracking capabilities in webSDK setups? What I want to achieve is to send an event when for example some process is completed (I cannot use URL) and use that event as a "viewed an mbox" goal for my activities. 

 

For extra information: I do not have Adobe Tags so I have implemented Target with Google Tag Manager and alloy.js.

 

Thank you a lot!

Thank you a lot!

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

I'm guessing you've seen this example already? A more simplified version of that example, if my event tracking mbox is called "conversionTest", could look something like this:

 

 

alloy("sendEvent", {
  xdm: {},
  decisionScopes: ['conversionTest']
}).then(function(result) {
  var propositions = result.propositions;
  if (propositions) {
      for (var i = 0; i < propositions.length; i++) {
          var proposition = propositions[i];
          if (proposition.scope === "conversionTest") {
              alloy("sendEvent", {
                  xdm: {
                      eventType: "decisioning.propositionDisplay",
                      _experience: {
                          decisioning: {
                              propositions: [{
                                  id: proposition.id,
                                  scope: proposition.scope,
                                  scopeDetails: proposition.scopeDetails
                              }]
                          }
                      }
                  }
              });
          }
      }
  }
});

 

 

 

 

View solution in original post

14 Replies

Avatar

Correct answer by
Employee Advisor

I'm guessing you've seen this example already? A more simplified version of that example, if my event tracking mbox is called "conversionTest", could look something like this:

 

 

alloy("sendEvent", {
  xdm: {},
  decisionScopes: ['conversionTest']
}).then(function(result) {
  var propositions = result.propositions;
  if (propositions) {
      for (var i = 0; i < propositions.length; i++) {
          var proposition = propositions[i];
          if (proposition.scope === "conversionTest") {
              alloy("sendEvent", {
                  xdm: {
                      eventType: "decisioning.propositionDisplay",
                      _experience: {
                          decisioning: {
                              propositions: [{
                                  id: proposition.id,
                                  scope: proposition.scope,
                                  scopeDetails: proposition.scopeDetails
                              }]
                          }
                      }
                  }
              });
          }
      }
  }
});

 

 

 

 

Avatar

Level 2

Thank you alexbishop,

 

I have tried that function but I have a follow up question: 

 

When I execute the function, I see an "interact" request in the network tab. That call I assume is from the first alloy sendEvent but then I was thinking I should see a second call from the second alloy sendEvent that signals the "propositionDisplay" event. The thing is that this second call is not showing.

 

Also for now I´m not seeing that "conversionTest" mbox inside Target. I believe this is due to the missing second call. 

 

Can you help with that?

 

Thank you!

Avatar

Employee Advisor

Yes, correct you should see a second call, could you share the code that you're using?

The mbox doesn't have to be called "conversionTest", you can name it anything; you can just type it into the field even if it doesn't already exist, so I can add a new mbox called newMboxName and it's not a problem that it shows "No matching results"

alexbishop_0-1709120937492.png

 

 

Avatar

Level 2

Yes the code I used is the same you shared with no changes:

 

alloy("sendEvent", {
  xdm: {},
  decisionScopes: ['conversionTest']
}).then(function(result) {
  var propositions = result.propositions;
  if (propositions) {
      for (var i = 0; i < propositions.length; i++) {
          var proposition = propositions[i];
          if (proposition.scope === "conversionTest") {
              alloy("sendEvent", {
                  xdm: {
                      eventType: "decisioning.propositionDisplay",
                      _experience: {
                          decisioning: {
                              propositions: [{
                                  id: proposition.id,
                                  scope: proposition.scope,
                                  scopeDetails: proposition.scopeDetails
                              }]
                          }
                      }
                  }
              });
          }
      }
  }
});

Avatar

Employee Advisor

Ok, and have you added conversionTest as the metric in the Goals & Settings section of the activity?

alexbishop_0-1709122021593.png

 

Avatar

Employee Advisor

Could you share what's in the response payload from your first sendEvent request? e.g. should look something like....

alexbishop_0-1709122521233.png

 

Avatar

Employee Advisor

The personalization:decisions payload from Target is empty, which implies that there is no match in for the mbox name (decisionScope) that was sent in the request. Is the activity live in Target?

Avatar

Level 2

So, I think I starting to get it. 

 

I need to create a "empty" activity that match that mbox name and put it live. Then implement a code like the one you provide at the beginning and finally count mbox displays in my real activity. 

 

Is that the process or am I missing something?

 

Thank you

Avatar

Employee Advisor

You wouldn't have an empty activity with that mbox name, you would just add a metric - with the definition of mbox name = myMboxName - to your real activity in the Goals & Settings section. Like this:

alexbishop_0-1709130416515.png

 

 

Avatar

Level 2

Thank alexbishop,

 

Now I´m seeing the two interact requests, the second with the event type "decisioning.propositionDisplay"

 

Now I need to wait if that add to the total mbox count of my activity. 

 

Thank you!

Avatar

Employee Advisor

Great, that's working as expected then, at least in terms of the two interact requests. Typical latency is around 4mins for the metric to update in the reporting UI

Avatar

Level 1

Hi! hopefully ok reviving an old thread ais ok/gets a response - but how does this propositionDisplay event flow through or 'stitch' to analytics?

Our datastream does have Analytics configured - but beyond that nothing has been set up in analytics itself. Most analytics 'hits' on the page are using the old API's for Analytics ie out of Launch and not using the websdk.
Target is migrating to websdk first.

But just so I understand, the propositionDisplay event type is only going to send a notification back to adobe target is that correct?