Expand my Community achievements bar.

Applications for the 2024 Adobe Target Community Mentorship Program are open! Click to the right to learn more about participating as either an Aspirant, to professionally level up with a new Certification, or as a Mentor, to share your Adobe Target expertise and inspire through your leadership! Submit your application today.
SOLVED

Passing entity.id and other parameters using Adobe Target v2 in SPA

Avatar

Level 2

Hi All,

            

To utilize the VEC – View Name .We configured as per below setup.

As now we have two rules added to the launch,

Current setup:

Rule 1 : Created a rule to Load Target in page. I use Library Load (page top) event. In actions Load Target , and Fire Page Load Request actions,

Rule 2 : Created a rule to get the view name using custom event, we use the technique of dispatching Custom Event on top of the view, which would trigger a Target call. This event is fired directly from application code.

Then inside the Launch ,I  set up custom event listeners which, when triggered, would fire a Target call.

Under Action – Add params to page load & Trigger view.

For Recommendations parameters for the SPA using Adobe Target V2 ext – Any specific documentation is available.

I can see the delivery call for each page.

In the add param’s I added the entity.id parameter  which will fetch the Id value from the Data element which will be populated from the data layer.

Unfortunately, In the delivery call, I am seeing parameter entity.id with empty value.

Before the data layer value is available on the page, this custom event rule is triggered, Some timing issue I think.Do we have any workaround or if  any of you have  inputs it would be helpful.

Clarification

Instead of Passing parameters through launch, Can i use  targetPageParams() directly on the page to pass the parameters on the respective pages.

 

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @pradeepr6574026  In the launch rule, try including a custom code before the Load Target action.

In this custom code, you can get the value of data element from data layer (when it is defined) and through targetPageParams  you can add this parameter to target call.

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @pradeepr6574026  In the launch rule, try including a custom code before the Load Target action.

In this custom code, you can get the value of data element from data layer (when it is defined) and through targetPageParams  you can add this parameter to target call.

Hi , Thanks for the response.

Inside the Custom code , what is logic is required?

if possible can you please add the code?

Avatar

Community Advisor

Hi @pradeep In rule1 action Load Target use a new action as Core--> Custom code.

 

In this custom code pass params using targetPageParam function only when datalayer is available on page.

window.targetPageParams = function() {
var returnString = "";
if(digitalData!="undefined")
{
var pn = digitalData.page.pageInfo.pageName;
returnString=returnString+"pgN= "+pn;
return returnString;
}
}

Hope that helps you.

Hi, Thanks for the response.

I added the logic inside the custom code(Application built with Angular) - Adobe Targetv2 added through Launch.

Being SPA Application, say for example , Page 1,Page 2, Page 3

Am in Page 3 , it should add Page 3 Name to the parameters, it is showing Page 2 Name in parameters.

if am refreshing the page , it is showing Page 3 name in the parameters.

I added library loaded(Top) event.

Thanks in Advance