Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Capture Activity and Experience ID in Profile Scripts?

Avatar

Level 2

Hi,

Is there a way I can captured an Activity ID and Experience ID displayed in a Profile Script? I think I've figured out the Activity, but there's nothing documented (clearly) on how to capture the Experience ID or Name as a Profile Attribute.

 

Thanks

8 Replies

Avatar

Community Advisor

hi @Robvienna1982  - you can capture ID of activity and experience using the dynamic parameter syntax (see below) and pass these from the activity-code using trackEvent() call. You can then create a Profile-script to read these params. 

Page-URL: https://experienceleague.adobe.com/docs/target/using/experiences/offers/passing-profile-attributes-t... 

${campaign.name}${campaign.recipe.name}${campaign.id}${campaign.recipe.id}

Avatar

Level 2

Thanks, I did take a look at that but we're using Tealium so it's not so straightforward it seems, we can't add a track event. What would the profile script look like if this was possible? i.e. how would we reference these new parameters? it wouldnt be an mbox_param would it?

Avatar

Community Advisor

hi @Robvienna1982  - trackEvent() is part of standard Adobe Target library which is part of Adobe Target tag-template within Tealium. You can check it easily by executing following command in browser-console and hopefully you get 'function' as a result

typeof(adobe.target.trackEvent)

If this works then you can use trackEvent() as part of the experience-code as well, like below:

adobe.target.trackEvent({
 "mbox": "collect-activity-data",
 "params": {
  "activity_id": "${campaign.id}",
  "experience_id": "${campaign.recipe.id}"
  } 
 });

And profile-script code would look like below for storing activity-id. Note that you may have to alter this code according to your use-case (for example, if you want to append all the activity-ids)

if (mbox.name == 'collect-activity-data') {
 	return mbox.param('activity_id');
 }

Avatar

Level 2

Thanks, getting there! I do get "function" back.

Can I ask - what is the source the trackEvent is accessing for the $(campaign...) values please?

 

I did try something similar to this but just got the actual value I typed in back:

"${campaign.id}",

---

Edit: Just realized, you've already said the activity-code. But I see our issue, we've not explicitly defined these variables manually in the activity code. So they'd come back as undefined.

 

I guess in each Experience we have, we need to define all these variables and values before this will work?

Avatar

Community Advisor

thats a good start @Robvienna1982 . Can you confirm where did you use the code related to trackEvent()? It must be used as part of the experience code that you define within Adobe Target console while building the activity. The dynamic parameters (ones with $) are replaced with corresponding values by the Adobe Target library before being presented to the client. These wont work if you use directly in Tealium/any other external library (or browser console).

Avatar

Level 2

That will probably be the issue, we're not using the VEC or similar. Just using the form based composer to retrieve JSON offers. example:

Robvienna1982_0-1662450443468.png

 

Avatar

Community Advisor

@Robvienna1982  - JSON offers are still used by a channel eventually to deliver the final experience. In that case, you have 2 approaches:

1. You can still use the dynamic parameters in JSON offer which can be read by the channel where you are delivering the final experience. From there you can execute trackEvent() call.

2. You can use Response Tokens to get the the ids of all activities and experiences, and pass these to Adobe Target using trackEvent(). Page below shows an example of sending AT data to Google Analytics - you can use Tealium Extensions to work in similar manner. 

https://experienceleague.adobe.com/docs/target/using/administer/response-tokens.html?lang=en#:~:text...

Avatar

Level 2

Great, thanks. Progress is being made!

Robvienna1982_0-1662463430158.png

I don't think #2 is viable as far as I'm aware, Response Tokens work after Profile Scripts? I just need to figure out now the profile script which lets me grab those values in the options > 0 > content response.