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

Adomik Analytics Adapter #1536

Merged
merged 3 commits into from
Sep 21, 2017
Merged

Conversation

Yann-Pravo
Copy link
Contributor

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • New analytics adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other

Description of change

New Adomik analytics adapter to integrate our script in Prebid.js

  • test parameters for validating bids
{
  bidder: 'adomik',
  params: {
      id: String, // id provided by Adomik
      url: String, // url provided by Adomik
      timeout: Int // optional (default 1000) in ms
  }
}
  • contact email of the adapter’s maintainer yann@adomik.com
  • official adapter submission

@Yann-Pravo
Copy link
Contributor Author

Hi @dbemiller,

I closed the previous pull request for greater clarity.
I also delete avsc and base64 from my code to not add any dependencies to the project.
The adapter is now light and clean.

Regards,

Yann.

@dbemiller dbemiller self-requested a review August 28, 2017 16:05
@dbemiller dbemiller self-assigned this Aug 28, 2017
track({ eventType, args }) {
switch (eventType) {
case auctionInit:
currentContext = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stay consistent with the other adapters, and initialize config params through enableAnalytics. See for example roxot or pubwise

describe('Adomik Prebid Analytic', function () {
describe('enableAnalytics', function () {
it('should catch all events', function () {
sinon.spy(adomikAnalytics, 'track');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spies need to be initialized & restored in beforeEach and afterEach blocks.

events.emit(constants.EVENTS.BID_TIMEOUT, {});
events.emit(constants.EVENTS.AUCTION_END, {});

sinon.assert.callCount(adomikAnalytics.track, 6);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really test your code at all. The prebid-core code is responsible for making sure that track is called when events are emitted.

Your tests need to make sure that the track implementation does what it's supposed to.

splittedUrl.forEach((split, i) => {
const partUrl = `${split}&id=${currentContext.id}&part=${i}&on=${splittedUrl.length - 1}`;
const img = new Image(1, 1);
img.src = 'http://' + currentContext.url + '/?q=' + partUrl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this makes a request on all the browsers you care about?

I'm cool with it if you are... but most people would use XMLHttpRequest. I'm not sure if anything in the HTML spec guarantees that the browser makes the request just by setting the src on an image, so it might throw off your stats.

@Yann-Pravo
Copy link
Contributor Author

Hi @dbemiller,

I updated the code to be consistent with other adapters.
I'm ok with the img.src, every browsers works with it.

Tell me if there's something wrong.

Regards,

Yann.

@matthewlane matthewlane merged commit 336f06f into prebid:master Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants