Search code examples
google-dfpimpressions

which step is for Google DFP impression


I wonder which code makes DFP counting. There are couple steps.

  1. googletag.defineSlot().addService(googletag.pubads());
  2. Googletag.pubads().enableSingleRequest();
  3. googletag.enableServices();
  4. googletag.cmd.push(function() { googletag.display(); });

If I don't call googletag.display method at step4, I guess impression doesn't increase. Is it correct?

ps.The reason I ask this question is I don't have permission to access 1,2,3 codes.But I need to hide Ads.

Thank you.


Solution

  • DFP counts an impression once an ad is selected on the server and returned to the client.

    Since you are using SingleRequest(), the impression is already counted before the creative gets rendered to the DOM. This said, the impression in your scenario is counted at step 3.

    It can cause many issues, because the SingleRequest() doesn't care if the push function is defined on your page or not. Therefore it could happen that 5 impressions are counted, while only 2 ads are served on the page.

    If you decide to not use SingleRequest(), DFP will count one impression with every single push function. (Step 4)

    There is the view-macro, which you implement in the creative itself. In this case an impression is triggered once 20% of the creative is actively seen by the user for at least one second, or when the first frame of a video-creative is shown.