react-google-publisher-tag icon indicating copy to clipboard operation
react-google-publisher-tag copied to clipboard

Are you familiar with enableSingleRequest()?

Open jackson-sandland opened this issue 6 years ago • 3 comments

I'm trying to implement enableSingleRequest(). I have it set up the way google suggests:

    this.googletag.cmd.push(() => {
      if (this.props.enableSingleRequest) {
        // Infinite scroll requires SRA
        this.googletag.pubads().enableSingleRequest();
      }

      // add support for async loading
      this.googletag.pubads().enableAsyncRendering();

      // collapse div without ad
      this.googletag.pubads().collapseEmptyDivs();

      // load ad with slot refresh
      this.googletag.pubads().disableInitialLoad();

      // enable google publisher tag
      this.googletag.enableServices();
    });

I have 6 ads on one of the pages, and I'm still seeing 6 requests. I'm also seeing multiple slots have the exact same ad, which is the problem that SRA is used to resolve. I have an adComponent that gets loaded in each slot. Do I need to restructure how I'm using my googleAd react component so that it works in harmony with the other slots? Any help is appreciated.

I found the high level solution in the google docs for enableSingeRequest() but no pattern for how to implement this in a react application:

Create one SRA request with all ad slots to best serve guaranteed
roadblocks or competitive exclusions, instead of sending 
SRA requests with one ad slot at a time.

Thanks :)

jackson-sandland avatar Jul 30 '19 23:07 jackson-sandland

Bueller?

jackson-sandland avatar Jul 31 '19 17:07 jackson-sandland

You can not use enableSingleRequest because it will not download new ads on the next page. This package is for SPA

seeden avatar Jul 31 '19 17:07 seeden

I figured out how to enable singleRequestArchitecture using enableSingleRequest in a react app using redux and I've verified that only one request results in 6 ad slots being served where previously there were 6 requests. One thing I'm not sure of is whether I should be seeing all unique ads. 3 of the ads are always the same ad - this is what SRA is meant to prevent. Google calls it a "guaranteed roadblock".

jackson-sandland avatar Aug 01 '19 18:08 jackson-sandland