Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Click tracking when using Prebid without the Ad Server #6225

Closed
fasenderos opened this issue Jan 26, 2021 · 4 comments
Closed

[Question] Click tracking when using Prebid without the Ad Server #6225

fasenderos opened this issue Jan 26, 2021 · 4 comments

Comments

@fasenderos
Copy link
Contributor

fasenderos commented Jan 26, 2021

Hi, my scenario is best described here. In short I have created an adapter only native for my SSP and a custom Prebid Module to run Prebid without an Ad Server. On page load, Prebid load two adapter (my own adapter and appnexus) + the custom Module.

The custom module listening for the AUCTION_END event, so when responses comes from SSPs, the event is fired and there I was able to select the winning creative for each placement with getHighestCpmBids(adUnit.code) . After that, creatives were printed with a custom function and everything seems to work fine.

Problems comes with click tracking on AppNexus side. To implement tracking, I have tried to emulate https://github.com/prebid/prebid-universal-creative/blob/master/src/nativeRenderManager.js

So in my custom Module when the highestCpmBids come from AppNexus I run the following script to track impressions:

const highestCpmBids = getGlobal().getHighestCpmBids(adUnit.code);
if (highestCpmBids.bidder !== "mycustomadapter") {
  // Fire Impression Tracker
  window.parent.postMessage(
      JSON.stringify({
        message: "Prebid Native",
        adId: highestCpmBids.adId,
      }),
      "*"
  );
}

While to track clicks I have added to all the creative links the class pb-click, the attribute pbadid=adId and a click listener in the custom function that render the creative:

function addPrebidClickTracker(placementDom, adId) {
  let links = placementDom.querySelectorAll("a.pb-click"); // We have 2 links, title and image
  let message = JSON.stringify({
    message: "Prebid Native",
    adId: adId,
    action: "click",
  });

  for (let i = 0; i < links.length; i++) {
    let link = links[i];
    if (link.addEventListener) {
      link.addEventListener(
        "click",
        function (event) {
          window.parent.postMessage(message, "*");
        },
        true
      );
    }
  }
}

That's an example of the html

<div id="##AD_UNIT_CODE##">
  <div class="nat-figure">
    <a href="##LINK_URL##" class="pb-click" pbadid="##adId##">
      <img src="##IMAGE_URL##" />
    </a>
  </div>
  <div class="nat-caption">
    <a href="##LINK_URL##" class="pb-click" pbadid="##adId##">
      <span class="nat-title">##CREATIVE_TITLE##</span>
    </a>
    <div class="nat-sponsor">##BRAND##</div>
  </div>
</div>

At the end Impressions and Viewable Impressions are quite close to those on our systems with a difference of +-5%, which is good to me. While Clicks are far lower than those monitored by us, 1 on Xandr against 120 on our system.

I know that this issue may not be directly related to Prebid, but I want to know if I've done everything I can do to track clicks or if something is missing.

Thanks in Advance

@fasenderos
Copy link
Contributor Author

fasenderos commented Jan 26, 2021

I forgot to mention when I click on the creative I can see a GET request on https://fra1-ib.adnxs.com/click?ABCDEFG0123456 that ends with 200 status.

@Fawke
Copy link
Contributor

Fawke commented Feb 2, 2021

@fasenderos,

I don't see any problem with your current setup and approach (though a bit unusual). Your creative template also looks to be rendering in the correct format.

As long as you see a GET call to https://fra1-ib.adnxs.com/click?ABCDEFG0123456, Xandr should be registering a click.

@fasenderos
Copy link
Contributor Author

@Fawke Thank you for confirming this

@fasenderos
Copy link
Contributor Author

Finally I got the answer to my doubts. Xandr, before sending the creatives to Prebid, do an auction with their own internal DSP and some other external DSP. And only the creatives that comes from their internal DSP will be tracked on their dashbord panel, others don't. That's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants