Rich-text Reply
Highlighted

Optimizely Web to change API call within react component

occitane a week ago

Optimizely Web to change API call within react component

Here is what I'm trying to create an experiment on Optimizely Web.

Homepage search loads to a JSP which will render a react component to render the result of the page. 

Would I be able to change the end point of the API which I called within the react component? 

Is this something doable within optimizely web or I'm better off to do it through Full Stack?

Level 1

mansoor-omar a week ago
 

Re: Optimizely Web to change API call within react component

Hi Occitane,

It sounds like you want to alter script execution within a file so this would be a Fullstack use case.

Regards
Manny
Optimizely

Re: Optimizely Web to change API call within react component

Independent of DEV work? Not likely...

Some options that might work if Full Stack is not an option for you:
You could have Optimizely set a window scoped variable
e.g.,
window.optimizelyUseNewSearchEndpoint = true

With that, based on timing, your DEVs might be able to alter the Search Results page so that it - based on the existence and value of that new variable - uses the current react component with the current endpoint vs a new component that uses the new endpoint (or something similar).

If the issue is that the Search Results page loads with the component already predetermined server-side, perhaps IT could use that variable to alter the URL of the Search Results page to include a query string parameter which the JSP recognizes as instructions to load the new component instead of the current one.
--Jason Dahlin
Analytics and Testing Guru Smiley Happy


Experimentation Hero