Expand my Community achievements bar.

SOLVED

How do I apply an experience to all views in a SPA?

Avatar

Level 3

So I have a page with two key sections on it - stuff above this nav and stuff below it. 

Michael_Wills_0-1675837347159.png

 

If I interact with the nav, the contents of the page below the nav change, while the contents above that nav do not.

The page (on initial load) defaults to showing the "Overview" nav item contents, and our current implementation is such that adobe.target.triggerView("Overview"); will fire at this point in time. 

The problem however is, lets say I want to change that image above the nav. When I load the page up in the VEC, the modifications pane says that my current view is "Overview" because of the defaulting described above. This means that any modification made under that circumstance, needs to wait until a call is made to pull in any modifications for the "Overview" view... which is not ideal from a page display timing issue perspective.

Is there a better way to do this so that I apply this modification at a more global state (i.e. not triggered by a single view)?

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @Michael_Wills,

If I understand correctly the SPA on view change does NOT change/update the content above the nav. The content above the nav is only loaded by the pageload. If so, one thing that might help in your situation is loading the page in the Visual Experience Composer (VEC) and then making the modification. As you noted, the VEC will automatically detect that the current view is, "overview" in your case. Once you've made the modification if you hover over it in the modification pane you'll see an icon that will let you "move" the modification to a different view or the pageload. Move the modification to the pageload.

2023-02-08_13-57-15.png

If you make multiple modifications move all the appropriate modifications. Then make sure your page delivery template rule applies appropriately to all the different URLs of your SPA. For example, if a visitor's pageload can happen on the "how to apply" page and you want that to also qualify for the new experience.

Hope that helps!

-R

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi @Michael_Wills,

If I understand correctly the SPA on view change does NOT change/update the content above the nav. The content above the nav is only loaded by the pageload. If so, one thing that might help in your situation is loading the page in the Visual Experience Composer (VEC) and then making the modification. As you noted, the VEC will automatically detect that the current view is, "overview" in your case. Once you've made the modification if you hover over it in the modification pane you'll see an icon that will let you "move" the modification to a different view or the pageload. Move the modification to the pageload.

2023-02-08_13-57-15.png

If you make multiple modifications move all the appropriate modifications. Then make sure your page delivery template rule applies appropriately to all the different URLs of your SPA. For example, if a visitor's pageload can happen on the "how to apply" page and you want that to also qualify for the new experience.

Hope that helps!

-R

Avatar

Level 3

Awesome! Thank you! That was totally not obvious to me haha. Exactly what I was looking for.