Event not change in SPA when move from one part to another

Avatar

Avatar

bhuwaneshp18

Avatar

bhuwaneshp18

bhuwaneshp18

20-07-2018

Hello I am implementing launch in my SPA(single page application) but when I click in another link the events which I use for previous click is still exit , can you please help me on this

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

StewSchilling

MVP

Avatar

StewSchilling

MVP

StewSchilling
MVP

20-07-2018

The good news is Launch works great for SPA sites.  Much of the pain that existed in DTM on SPA sites is gone!

The bad news is... Well, I don't know. Maybe there is none.

There are a couple things to consider when using Launch on a SPA site.

1) Launch is loaded when the SPA is loaded.  This means that the Page Load event triggers, Library Loaded (pageTop), Page Bottom, DOM Ready, and Window Loaded will only happen once.  It's not a problem, it just has to be understood.

2) Anything that would normally persist for the lifetime of the window will persist for the lifetime of the SPA.  This used to be a problem with data elements in DTM.  In Launch, you can set the persistence of a data element to 'None' which means that it will always pull the most current info when referenced.

3) Following on from #2, Adobe Analytic's 's' object and the values set for props, eVars, settings, and events will also persist as long as the SPA.  This sounds like the issue that you are seeing.  Luckily, in Launch, the engineers chose to create three actions for Adobe Analytics (Set Values, Clear Values, and Send Beacon).  The presumed solution to your issue is to religiously execute the Clear Values  action either before Set Values or after Send Beacon.   This wipes the slate clean before or after each beacon call.

3b). If you prefer, there is another way to make sure that your AA values are always intentional.  This is to implement the post beacon callback in your AA extension's custom page code.  See below.

s.registerPostTrackCallback(function(){

  s.clearVars();

});

This causes s.clearVars() to be automatically called after each and every beacon that is sent.  It's a pretty nice thing for DTM or Launch on SPA sites.

Answers (0)