Skip to content

Commit

Permalink
Move ads/adsense.* and ads/doubleclick.* to ads/google/
Browse files Browse the repository at this point in the history
Add ads/google/utils.js, as a place for code to be shared by adsense.js and doubleclick.js.
  • Loading branch information
bobcassels committed Mar 28, 2016
1 parent bbbb7e6 commit 26de70a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
4 changes: 2 additions & 2 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import {a9} from '../ads/a9';
import {adblade, industrybrains} from '../ads/adblade';
import {adform} from '../ads/adform';
import {adreactor} from '../ads/adreactor';
import {adsense} from '../ads/adsense';
import {adsense} from '../ads/google/adsense';
import {adtech} from '../ads/adtech';
import {plista} from '../ads/plista';
import {criteo} from '../ads/criteo';
import {doubleclick} from '../ads/doubleclick';
import {doubleclick} from '../ads/google/doubleclick';
import {dotandads} from '../ads/dotandads';
import {endsWith} from '../src/string';
import {facebook} from './facebook';
Expand Down
2 changes: 1 addition & 1 deletion ads/adsense.js → ads/google/adsense.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {checkData} from '../src/3p';
import {checkData} from '../../src/3p';

/**
* @param {!Window} global
Expand Down
File renamed without changes.
17 changes: 2 additions & 15 deletions ads/doubleclick.js → ads/google/doubleclick.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

import {loadScript, checkData} from '../src/3p';
import {loadScript, checkData} from '../../src/3p';
import {getCorrelator} from './utils';

/**
* @param {!Window} global
Expand Down Expand Up @@ -167,17 +168,3 @@ function doubleClickWithGlade(global, data) {
window.glade = {correlator: getCorrelator(global)};
loadScript(global, 'https://securepubads.g.doubleclick.net/static/glade.js');
}

/**
* @param {!Object} data
* @return {number}
*/
function getCorrelator(global) {
const clientId = global.context.clientId;
const pageViewId = global.context.pageViewId;
if (global.context.clientId) {
return pageViewId + (clientId.replace(/\D/g, '') % 1e6) * 1e6;
} else {
return pageViewId;
}
}
File renamed without changes.
29 changes: 29 additions & 0 deletions ads/google/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @param {!Window} global
* @return {number}
*/
export function getCorrelator(global) {
const clientId = global.context.clientId;
const pageViewId = global.context.pageViewId;
if (global.context.clientId) {
return pageViewId + (clientId.replace(/\D/g, '') % 1e6) * 1e6;
} else {
return pageViewId;
}
}
2 changes: 1 addition & 1 deletion ads/openx.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {loadScript, writeScript, checkData} from '../src/3p';
import {doubleclick} from '../ads/doubleclick';
import {doubleclick} from '../ads/google/doubleclick';

/**
* @param {!Window} global
Expand Down
2 changes: 1 addition & 1 deletion ads/rubicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {writeScript, loadScript, checkData} from '../src/3p';
import {getSourceUrl} from '../src/url';
import {doubleclick} from '../ads/doubleclick';
import {doubleclick} from '../ads/google/doubleclick';

/**
* @param {!Window} global
Expand Down
4 changes: 2 additions & 2 deletions builtins/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ resources in AMP. It requires a `type` argument that select what ad network is d
- [Adblade](../ads/adblade.md)
- [Adform](../ads/adform.md)
- [AdReactor](../ads/adreactor.md)
- [AdSense](../ads/adsense.md)
- [AdSense](../ads/google/adsense.md)
- [AdTech](../ads/adtech.md)
- [Criteo](../ads/criteo.md)
- [Dot and Media](../ads/dotandads.md)
- [Doubleclick](../ads/doubleclick.md)
- [Doubleclick](../ads/google/doubleclick.md)
- [Flite](../ads/flite.md)
- [Improve Digital](../ads/improvedigital.md)
- [Industrybrains](../ads/industrybrains.md)
Expand Down

0 comments on commit 26de70a

Please sign in to comment.