Skip to content

Commit

Permalink
Optimon Analytics Adapter: add new analytics adapter (#6333)
Browse files Browse the repository at this point in the history
* Publish the Optimon platform's analytics adapter for prebid

Added js and md files for the analytics adapter.

* Fix wrong content in MD file

* Fix wrong content in MD file

* Created unit testing to Optimon Analytics Adapter

* Created unit testing to Optimon Analytics Adapter

* Created unit testing to Optimon Analytics Adapter

* Created unit testing to Optimon Analytics Adapter

* Fixes ESlint styling

* Removing DEF const

* Created unit testing to Optimon Analytics Adapter

* Created unit testing to Optimon Analytics Adapter
  • Loading branch information
pixelgroup-israel authored and idettman committed May 21, 2021
1 parent f141547 commit 6793418
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
25 changes: 25 additions & 0 deletions modules/optimonAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
*
*********************************************************
*
* Optimon.io Prebid Analytics Adapter
*
*********************************************************
*
*/

import adapter from '../src/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';

const optimonAnalyticsAdapter = adapter({
global: 'OptimonAnalyticsAdapter',
handler: 'on',
analyticsType: 'bundle'
});

adapterManager.registerAnalyticsAdapter({
adapter: optimonAnalyticsAdapter,
code: 'optimon',
});

export default optimonAnalyticsAdapter;
13 changes: 13 additions & 0 deletions modules/optimonAnalyticsAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Overview

Module Name: Optimon.io Prebid Analytics Adapter
Module Type: Analytics Adapter
Maintainer: [email protected]

# Description

Start analyzing your Prebid performance by visiting our website [Optimon.io](https://optimon.io/?utm_source=prebid-org&utm_medium=analytics-adapter) or contact us directly by email: [[email protected]](mailto:[email protected]) to get started.

# Platform Details

[Optimon.io](https://optimon.io/?utm_source=prebid-org&utm_medium=analytics-adapter) is a Robust Alerting & Reporting Platform for Prebid and GAM that helps publishers make the right decisions by collecting data from your Google Ad Manager, Prebid, and other SSPs and providing smart insights and suggestions to optimize and maximize their overall yield and save manual work.
40 changes: 40 additions & 0 deletions test/spec/modules/optimonAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as utils from 'src/utils.js';
import { expect } from 'chai';
import optimonAnalyticsAdapter from '../../../modules/optimonAnalyticsAdapter.js';
import adapterManager from 'src/adapterManager';
import events from 'src/events';
import constants from 'src/constants.json'

const AD_UNIT_CODE = 'demo-adunit-1';
const PUBLISHER_CONFIG = {
pubId: 'optimon_test',
pubAdxAccount: 123456789,
pubTimezone: 'Asia/Jerusalem'
};

describe('Optimon Analytics Adapter', () => {
const optmn_currentWindow = utils.getWindowSelf();
let optmn_queue = [];

beforeEach(() => {
optmn_currentWindow.OptimonAnalyticsAdapter = (...optmn_args) => optmn_queue.push(optmn_args);
adapterManager.enableAnalytics({
provider: 'optimon'
});
optmn_queue = []
});

afterEach(() => {
optimonAnalyticsAdapter.disableAnalytics();
});

it('should forward all events to the queue', () => {
const optmn_arguments = [AD_UNIT_CODE, PUBLISHER_CONFIG];

events.emit(constants.EVENTS.AUCTION_END, optmn_arguments)
events.emit(constants.EVENTS.BID_TIMEOUT, optmn_arguments)
events.emit(constants.EVENTS.BID_WON, optmn_arguments)

expect(optmn_queue.length).to.eql(3);
});
});

0 comments on commit 6793418

Please sign in to comment.