react-dfp icon indicating copy to clipboard operation
react-dfp copied to clipboard

Ads not delivered sometimes on client side routing

Open eltonjothi opened this issue 5 years ago • 4 comments

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

eltonjothi avatar May 29 '19 10:05 eltonjothi

added a sandbox example

eltonjothi avatar May 29 '19 14:05 eltonjothi

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.

jaanauati avatar Jun 01 '19 03:06 jaanauati

Thanks..!! this works and will do for now :).. Although updateCorrelator seems to be deprecated, Looking forward for a better solution

eltonjothi avatar Jun 01 '19 17:06 eltonjothi

@jaanauati any update on this? As updateCorrelator is deprecated, what should be the correct way of handling client side navigation?

asimqt avatar Mar 11 '20 13:03 asimqt