Skip to content

Commit 43fc027

Browse files
authored
Add global radio ad tag (MailOnline#24)
* Add global radio ad tag Add production, test and debug build commands * Add nigella site adtags
1 parent 6140350 commit 43fc027

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"main": "bundle.js",
66
"scripts": {
77
"start": "webpack-dev-server",
8-
"build": "webpack -p",
8+
"debug-build": "NODE_ENV='development' webpack --define process.env.NODE_ENV='development'",
9+
"test-build": "NODE_ENV='development' webpack --optimize-minimize --define process.env.NODE_ENV='development'",
10+
"prod-build": "NODE_ENV='production' webpack -p",
911
"test": "eslint src"
1012
},
1113
"repository": {

src/App.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import * as clientUtils from './client';
77

88
const Modernizr = window.suggestv.Modernizr;
99
const CLIENT = clientUtils.getClient();
10+
const ENV = String(process.env.NODE_ENV);
11+
const API_URL = process.env.NODE_ENV === 'production' ? 'https://api.suggestv.io/semantics' : 'https://uat.suggestv.io/semantics';
12+
const ANALYTICS_URL = process.env.NODE_ENV === 'production' ? 'https://analytics.suggestv.io/track' : 'https://test.suggestv.io/analytics/track';
1013

1114
class App extends React.Component {
1215
static getVideos(url, client) {
13-
const endpoint = `https://api.suggestv.io/semantics?url=${url}&client=${client}`;
16+
const endpoint = `${API_URL}?url=${url}&client=${client}`;
1417

1518
return fetch(endpoint, {
1619
method: 'GET',
@@ -53,6 +56,8 @@ class App extends React.Component {
5356
if (CLIENT === 'sovrnus') return cb(null, 'http://ap.lijit.com/www/delivery/vst.php?zoneid=463506');
5457
if (CLIENT === 'hitc') return cb(null, 'https://ad.360yield.com/advast?p=1034241&w=4&h=3');
5558
if (CLIENT === 'clickon') return cb(null, `https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/14188402/CLICKON/preroll&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=${url}&description_url=${url}&correlator=${Date.now()}`);
59+
if (CLIENT === 'global-radio') return cb(null, 'http://adserver.adtech.de/?advideo/3.0/646.1/6441115/0/0/cc=2;vidAS=pre_roll;cors=yes;VidRT=VAST;VidRTV=3.0');
60+
if (CLIENT === 'nigella') return cb(null, 'https://ads.stickyadstv.com/www/delivery/swfIndex.php?reqType=AdsSetup&protocolVersion=2.0&zoneId=1016097');
5661
if (CLIENT === 'telegraph' && tmgAdsBuildAd) {
5762
return App.getPlaylistAdTag(tmgAdsBuildAd('advert_body_vid', '', '', '').fetchUrl(), cb);
5863
}
@@ -195,7 +200,7 @@ class App extends React.Component {
195200
postAnalytics(player) {
196201
if (player.playlist.currentItem() === -1) { return; }
197202

198-
fetch('https://analytics.suggestv.io/track', {
203+
fetch(ANALYTICS_URL, {
199204
method: 'POST',
200205
headers: {
201206
Accept: 'application/json',

src/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const CONFIG = {
33
selector: 'article[itemprop=articleBody]'
44
},
55
'nigella': {
6-
selector: 'section.details'
6+
selector: 'div.related-tips'
77
}
88
}
99

webpack.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ module.exports = {
5353
plugins: [
5454
extractSass,
5555
videoJsProvider,
56-
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' })
56+
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' }),
57+
new webpack.DefinePlugin({
58+
'process.env': {
59+
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
60+
}
61+
}),
5762
],
5863
resolve: {
5964
extensions: ['.js', '.jsx'],

0 commit comments

Comments
 (0)