react-dfp
react-dfp copied to clipboard
Ads not delivered sometimes on client side routing
Ads do not get displayed while routing through client side for my SPA
Added an example below: Keep switching between the pages Ad1 and ad2.. after switching pages 2-4 times, the ads stop loading https://codesandbox.io/s/helloworld-ucyql?fontsize=14
added a sandbox example
I see the issue, It seems like dfp is returning empty ads after the third / fourth load, the problem seem to be that react-dfp is not explicitly refreshing the correlator id.
You can workaround this by running the following code when the url changes:
DFPManager.getGoogletag().then(googletag =>
googletag.pubads().updateCorrelator()
);
I forked your example and added the patch to index.js so you can see this working: https://codesandbox.io/s/helloworld-lwjb2
I'm keeping this ticket opened until a better / long-term solution is implemented and please let me know if u still have issues.
Thanks.
Thanks..!! this works and will do for now :).. Although updateCorrelator seems to be deprecated, Looking forward for a better solution
@jaanauati any update on this? As updateCorrelator is deprecated, what should be the correct way of handling client side navigation?