React SPA & Form-Based Experience Composer | Community
Skip to main content
Level 2
May 5, 2023
Solved

React SPA & Form-Based Experience Composer

  • May 5, 2023
  • 3 replies
  • 1505 views

Hi all,

 

How can I target a specific view in React SPA with the form base composer? It only works on the first page load but not if I navigate to a new page/view.

 

I know it is possible with VEC, but I can't use it.

 

Many thanks,

UK

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Perrin_Ennen

Hi @ukch,

You can use adobe.target.triggerView() accordingly when navigating to a new page. It is important that at.js 2.x is used.


https://experienceleague.adobe.com/docs/target-learn/tutorials/experiences/use-the-visual-experience-composer-for-single-page-applications.html

 

Hope this helps you
Best regards

3 replies

Perrin_Ennen
Community Advisor
Perrin_EnnenCommunity AdvisorAccepted solution
Community Advisor
May 5, 2023

Hi @ukch,

You can use adobe.target.triggerView() accordingly when navigating to a new page. It is important that at.js 2.x is used.


https://experienceleague.adobe.com/docs/target-learn/tutorials/experiences/use-the-visual-experience-composer-for-single-page-applications.html

 

Hope this helps you
Best regards

UKCHAuthor
Level 2
May 8, 2023

Hi @perrin_ennen, thank you, but as I wrote in the question, I can't create an VEC A/B test, is it possible to use triggerView() with form-based A/B tests?

Perrin_Ennen
Community Advisor
Community Advisor
May 10, 2023

Hi @ukch,

 

Hi,
I am not quite sure myself - as far as I know triggerView() is rather meant for VEC and serverside targeting.

 

I remember a SPA where I worked with form-based experiments. I don't know if that was a good solution. But in that case I triggered even the target-global-mbox (by adobe.target.getOffer() ..) on a SPA page change. The activity was built in such a way, that it itself determines in which view the page is located. Works technically - but yes - you have to be careful that e.g. no other activities are running on the pages - or that is considered accordingly there.