How to dedupe server calls from a single page app? | Community
Skip to main content
Level 2
January 18, 2022
Solved

How to dedupe server calls from a single page app?

  • January 18, 2022
  • 2 replies
  • 874 views

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

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 Pablo_Childe

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

 

2 replies

Level 2
January 19, 2022

@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.

Pablo_Childe
Community Advisor
Pablo_ChildeCommunity AdvisorAccepted solution
Community Advisor
January 19, 2022

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