Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

How to dedupe server calls from a single page app?

Avatar

Level 2

Hi community,

 

we have recently discovered we have multiple identical server calls in some instances.

Did anyone had this issue?

What is the best way to dedupe those through Launch?

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi in SPA like angular based apps. What often happens is a master index.html file calls your templates and analytics and then your state changes also fire to in essense make  2 server calls.

 

1st thing for SPAs i recommend use direct call rules for state change(virtual page view in essence). They should then only fire once per navigation. This will mean you need a digitaldatalayer in place to populate things like pagename.

 

Once this is done then your devs need to on first page load disable the index load so just the direct call rule fires.

 

Also in SPAs make sure dev trigger direct call rules on back and forward browser navigations.

 

GLTU

 

View solution in original post

2 Replies

Avatar

Level 2

@dim21 Since the server calls are identical then you might want to check if the Launch rule is not enclosed in a loop in the implementation. Also, evaluate the rule events on which a rule is firing. It might be possible that if the event is a direct call rule than the same might be getting called multiple times in the implementation.

Avatar

Correct answer by
Community Advisor

Hi in SPA like angular based apps. What often happens is a master index.html file calls your templates and analytics and then your state changes also fire to in essense make  2 server calls.

 

1st thing for SPAs i recommend use direct call rules for state change(virtual page view in essence). They should then only fire once per navigation. This will mean you need a digitaldatalayer in place to populate things like pagename.

 

Once this is done then your devs need to on first page load disable the index load so just the direct call rule fires.

 

Also in SPAs make sure dev trigger direct call rules on back and forward browser navigations.

 

GLTU