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

SOLVED

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

pradeepr6574026
Level 2
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
LordOfTheRings
Correct answer by
Level 7
Level 7

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
LordOfTheRings
Correct answer by
Level 7
Level 7

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

pradeepr6574026
Level 2
Level 2

Hi , Thanks for the response.

Inside the Custom code , what is logic is required?

if possible can you please add the code?

LordOfTheRings
Level 7
Level 7

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.

pradeepr6574026
Level 2
Level 2

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