Expand my Community achievements bar.

SOLVED

SPA TriggerView Based on ID

Avatar

Level 2

I have a SPA that I am looking to run Target experiences on.

The SPA doesnt have the url update with hash segments so the URL remains the same as different content is displayed/loaded.

There are different sections to the SPA though with unique IDs setup on key components.

 

Target on the initial page load can change and update content with an experience running as expected but as soon as state changes things break and experience no longer loads.

 

Target then notes error indicating that the action could not be displayed due to a missing/invalid mbox name.

 

My assumption is its due to the state changing and my thinking is to see if a TriggerView on a particular ID being present will resolve the Mbox issue.

 

If anyone can assist on potential pointers on getting a TriggerView to fire on a ID being present.  Would a simple getElementByID type call be as complicated as things are?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@CurtisYoung1987 If you are implementing Target using Launch then there is a simple option of firing triggerView based upon selector ID :

Gaurav_Singh_0-1658837586084.png

Which may help you in achieving the use case . Else the other option would be to trigger the triggerView function on event/action for a specific element . Was able to find a similar use case discussed over this you tube link : https://www.youtube.com/watch?v=deAUBBDYRWQ .

 

Hope this helps.

 

View solution in original post

2 Replies

Avatar

Community Advisor

Hi @CurtisYoung1987 you may need to modify the triggerView Implementation to read the ID change. If the updated code is able to identify this change then you can easily use the triggers.

 

If that is not possible , then you can write the js code to write the experience using form based or code editor of VEC.

 

Hope that helps.

Avatar

Correct answer by
Employee Advisor

@CurtisYoung1987 If you are implementing Target using Launch then there is a simple option of firing triggerView based upon selector ID :

Gaurav_Singh_0-1658837586084.png

Which may help you in achieving the use case . Else the other option would be to trigger the triggerView function on event/action for a specific element . Was able to find a similar use case discussed over this you tube link : https://www.youtube.com/watch?v=deAUBBDYRWQ .

 

Hope this helps.