Skip to content

Commit

Permalink
Add global radio ad tag (MailOnline#24)
Browse files Browse the repository at this point in the history
* Add global radio ad tag
Add production, test and debug build commands

* Add nigella site adtags
  • Loading branch information
iq-dot authored Jul 5, 2017
1 parent 6140350 commit 43fc027
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "bundle.js",
"scripts": {
"start": "webpack-dev-server",
"build": "webpack -p",
"debug-build": "NODE_ENV='development' webpack --define process.env.NODE_ENV='development'",
"test-build": "NODE_ENV='development' webpack --optimize-minimize --define process.env.NODE_ENV='development'",
"prod-build": "NODE_ENV='production' webpack -p",
"test": "eslint src"
},
"repository": {
Expand Down
9 changes: 7 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import * as clientUtils from './client';

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

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

return fetch(endpoint, {
method: 'GET',
Expand Down Expand Up @@ -53,6 +56,8 @@ class App extends React.Component {
if (CLIENT === 'sovrnus') return cb(null, 'http://ap.lijit.com/www/delivery/vst.php?zoneid=463506');
if (CLIENT === 'hitc') return cb(null, 'https://ad.360yield.com/advast?p=1034241&w=4&h=3');
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()}`);
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');
if (CLIENT === 'nigella') return cb(null, 'https://ads.stickyadstv.com/www/delivery/swfIndex.php?reqType=AdsSetup&protocolVersion=2.0&zoneId=1016097');
if (CLIENT === 'telegraph' && tmgAdsBuildAd) {
return App.getPlaylistAdTag(tmgAdsBuildAd('advert_body_vid', '', '', '').fetchUrl(), cb);
}
Expand Down Expand Up @@ -195,7 +200,7 @@ class App extends React.Component {
postAnalytics(player) {
if (player.playlist.currentItem() === -1) { return; }

fetch('https://analytics.suggestv.io/track', {
fetch(ANALYTICS_URL, {
method: 'POST',
headers: {
Accept: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const CONFIG = {
selector: 'article[itemprop=articleBody]'
},
'nigella': {
selector: 'section.details'
selector: 'div.related-tips'
}
}

Expand Down
7 changes: 6 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ module.exports = {
plugins: [
extractSass,
videoJsProvider,
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' })
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' }),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
],
resolve: {
extensions: ['.js', '.jsx'],
Expand Down

0 comments on commit 43fc027

Please sign in to comment.