Expand my Community achievements bar.

SOLVED

Problem with Target Audiences and Profile Scripts

Avatar

Level 2

Hi everyone,

I'm trying to create audiences in Adobe Target using profile scripts. This is my first time attempting this, so I followed this guide to send the data I need for the profile scripts from Data Collection:
https://experienceleague.adobe.com/en/docs/platform-learn/implement-web-sdk/applications-setup/setup...

This is how we map the data to be send. In a data element:

 

var data = {
   __adobe: {
      target: {
        "profile.comprobarIngresosSimulador": _satellite.getVar("originadorSimulacion | comprobarIngresosSimulador"),
        "profile.montoPrestamoSimulado": _satellite.getVar("originadorSimulacion | montoPrestamoSimulado"),
        "profile.pagoFijo": _satellite.getVar("originadorSimulacion | pagoFijo"),
        "profile.plazoSimulado": _satellite.getVar("originadorSimulacion | plazoSimulado"),
        "profile.producto": _satellite.getVar("originadorSimulacion | producto"),
        "profile.tasaInteres": _satellite.getVar("originadorSimulacion | tasaInteres"),
      }
   }
}

return data;

 

 

To verify that the data is being sent to Target, I checked the request payload and confirmed that the object with the necessary data is included, as shown in the attached image.

shamir_duran_0-1739306209795.png

 

In Target, I created a profile script (named originadorSimulacion_producto) that uses one of these fields:

 

return user.get('plazoSimulado') || 0;

 


I also created an audience with the following condition:

 

Visitor Profile: user.originadorSimulacion_producto Contains (case insensitive) 48

 

 

However, when I try to qualify for the audience following the necessary steps, it doesn't work. Additionally, based on the response tokens I enabled for debugging, I noticed that the profile script is returning the default value instead of the value sent.

My goal is to create simple audiences based on user interactions and use them to deliver personalized experiences. I know this can be achieved with RT-CDP, but we don't have the license for this project. We have Analytics but audiences shared from there to Target take up to 8 hours to qualify.

Is it possible to achieve this using profile scripts? Am I missing something in the configuration? I appreciate any help!

Thanks in advance!

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hello, @shamir_duran,

 

I think that your problem is in the scope. What scope are you using when you are sending this event? The "global mbox scope" is "__view__". Try to send it alongside data. Other way to do it is to use the same scope (location) in the JSON Offer as the one you are sending the data object to. 

 

An example of the event you have to send:

await aepalloy("sendEvent", {
  "renderDecisions": true,
  "personalization": {
    "sendDisplayEvent": false
  },
  "xdm": {},
  "decisionScopes": ["__view__"], //  you can add an additional scope in here
  "data": {
    __adobe: {
      target: {
        "profile.comprobarIngresosSimulador": _satellite.getVar("originadorSimulacion | comprobarIngresosSimulador"),
        "profile.montoPrestamoSimulado": _satellite.getVar("originadorSimulacion | montoPrestamoSimulado"),
        "profile.pagoFijo": _satellite.getVar("originadorSimulacion | pagoFijo"),
        "profile.plazoSimulado": _satellite.getVar("originadorSimulacion | plazoSimulado"),
        "profile.producto": _satellite.getVar("originadorSimulacion | producto"),
        "profile.tasaInteres": _satellite.getVar("originadorSimulacion | tasaInteres"),
      }
    }
  }
});


And here is an example of the scope mentioned above:

GigiCotruta_0-1739432805106.png

 

View solution in original post

9 Replies

Avatar

Correct answer by
Level 3

Hello, @shamir_duran,

 

I think that your problem is in the scope. What scope are you using when you are sending this event? The "global mbox scope" is "__view__". Try to send it alongside data. Other way to do it is to use the same scope (location) in the JSON Offer as the one you are sending the data object to. 

 

An example of the event you have to send:

await aepalloy("sendEvent", {
  "renderDecisions": true,
  "personalization": {
    "sendDisplayEvent": false
  },
  "xdm": {},
  "decisionScopes": ["__view__"], //  you can add an additional scope in here
  "data": {
    __adobe: {
      target: {
        "profile.comprobarIngresosSimulador": _satellite.getVar("originadorSimulacion | comprobarIngresosSimulador"),
        "profile.montoPrestamoSimulado": _satellite.getVar("originadorSimulacion | montoPrestamoSimulado"),
        "profile.pagoFijo": _satellite.getVar("originadorSimulacion | pagoFijo"),
        "profile.plazoSimulado": _satellite.getVar("originadorSimulacion | plazoSimulado"),
        "profile.producto": _satellite.getVar("originadorSimulacion | producto"),
        "profile.tasaInteres": _satellite.getVar("originadorSimulacion | tasaInteres"),
      }
    }
  }
});


And here is an example of the scope mentioned above:

GigiCotruta_0-1739432805106.png

 

Avatar

Level 2

Thank you for your response.

 

I am using the view scope. I also tried adding an additional scope as you suggested, but the issue persists. What I would really like to understand is why I am unable to use the sent data inside the profile script—it seems as if the data is not reaching it.

 

By the way, I am not using Alloy to send events. Instead, I am using adobeDataLayer.push. From a rule that triggers when a push with a specific event name is received, then I send the data to both Adobe Analytics and Adobe Target.

shamir_duran_0-1739455710229.png

 

Avatar

Level 3

Did you enabled the profile.plazoFijo, profile.plazoSimulado etc. In response tokens? You have that in administration tab. 

Avatar

Level 2

Yes, I did.

shamir_duran_1-1739459131531.png


Here is the information sent to Adobe Target when users submit the form:

shamir_duran_2-1739459153843.png


In Adobe Target, I have a profile script that returns the plazoSimulado field so it can be used in the audience segmentation:

shamir_duran_3-1739459185328.png


The audience is defined as follows. The goal is to validate specific values entered by the user, but for testing purposes, I currently have it set to match any value:

shamir_duran_4-1739459238690.png

 

Finally, when I visit the landing page where the experience is configured for this audience, I check the response and see that it is using the default value defined in the profile script, which should only apply when the variable is empty:

shamir_duran_5-1739459296832.png

 

Avatar

Level 3

Try to debug using the profile endpoint: https://<TENANT_ID>.tt.omtrdc.net/rest/v1/profiles/marketingCloudVisitorId/:ECID?client=<TENANT_ID>

 

You can also try using a variable type and then update it before the "Send event".

Data element:

GigiCotruta_0-1739519431255.png

Rule:

GigiCotruta_1-1739519593671.png

Also, I would hightly reccomend using the alloy library as it impacts the server side. When you push to to DL you ar eusing client side. Target is working with the Edge network (server side). I think that it is the main reason why it is not working for you. 

Try and push a function using alloy in the console, the one I sent you before, then, check the profile using the endpoint. If it is registered, then you know the problem. 

 

Avatar

Level 2

Hi @GigiCotruta 

I did a test by replacing dataLayer with Alloy and following your structure for sending data to Target, and it worked correctly.

 window.alloy("sendEvent", {
          renderDecisions: true,
          type: "web.webinteraction.linkClicks",
          decisionScopes: ["__view__"],
          xdm: {},
          data: {
            __adobe: {
              target: {
                "profile.montoPrestamoSimulado": 1150000,
                "profile.pagoFijo": 100000,
                "profile.plazoSimulado": plazoSimulado,
                "profile.producto": "Credito Express",
              },
            },
          },
        });

 

Since the data was sent within data.__adobe.target, it was possible to use it directly in the audience as part of the user profile without creating a profile script.

 

Thanks for your help with this issue!

Avatar

Level 3

I'm really glad that helped you. If you have any other questions with Target, let me know. 

 

🫂 

Avatar

Level 9

Hi @shamir_duran , 

I can suggest you an alternate approach which works correctly for me. 

Instead of using adobeDataLayer.push, you can trigger an Alloy function to send event along with your required parameters. 


For example : 

   window.alloy("sendEvent", {
      "renderDecisions": false,
      decisionScopes: ["__view__"],
      "xdm": {
        "web": {
          "webPageDetails": {
            "plazoSimulado": "test"
          }
        }
      }
    })


After you send the above alloy function, you can create a profile script to read your parameter as given below : 

return mbox.param("web.webPageDetails.plazoSimulado");


Hope you find it useful.

Best Regards, 
Vaibhav Mathur

Avatar

Level 2

Hi @Vaibhav_Mathur 

It worked using Alloy instead of dataLayer.

 

To make the data persistent, I simply added this to the profile script:

user.setLocal("plazoSimulado", mbox.param("web.webPageDetails.plazoSimulado"))

and then retrieved it using

user.getLocal("plazoSimulado")



Thanks for your suggestion!