Campaign with SPA-Events



  • Permanently deleted user

    Hi Maximilian,


    In case you want to run the experiment only once, you need to disable the option to serve the experiment on SPA event ("Serve on every SPA event").

    Please see the screenshot below.


    Comment actions Permalink
  • Maximilian Peters

    Hey Yossi,

    if I disable the option I get the next Problem:

    I see the campaign twice and the campaign is doen't change, if I change the seachterm. For example the three images on the top should change for each search term. If I search a product, which is not defined in the campaign no image should be displayed.


    Comment actions Permalink
  • Lior Delouya

    Hi Max,

    In your case, a user can start a search with "herd" term - which means the use case will render twice - one time because of the real page load, and another because of the SPA. 

    My recommendation will be to create an evaluator the will check if the experiment is already there, you can do it by waiting in the evaluator to a unique ID you will create in the banner HTML itself --> If the ID is there, the experiment won't be rendered again.

    The experience you are trying to create is a bit tricky - you might find more edge cases as you move forward... 

    Comment actions Permalink
  • Guy Dynamic

    Adding my 2 cents, 
    Using add-after and add-before in a spa sites, always holds a small risk of component duplication.

    The problem occurs when you insert the DY html in an area that is not being deleted when a "page transition" occurs, which results of re-rendering the same campaign again and again.

    My suggestions:

    1. As written here, make sure you are not triggering the SPA event on the same pageview that the DY scripts were loaded on (and start reporting "SPAs" only from the 2nd pageview), as the DY scripts already running the required functionality for the 1st pageview.

    2. Try and use "replace" instead of "add-before" or "add-after". if you have the option to insert an empty "div" using your CMS, and render the DY component in there using "replace", you are not suppose to see duplication. You can also use a DY custom code to create an empty div to hold your Dynamic Content, and use JS to make sure you are not creating this empty div if its already on the page.

    Comment actions Permalink

Please sign in to leave a comment.