Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Mapping Billing Invoice Code field to campaigns, allowing custom QA f…
Browse files Browse the repository at this point in the history
…unctions to be configured in the sheet, mapping new fields to allow creation of tracking creatives in bulk

Change-Id: Ie680dc42529f745638d62014697d109dbdddc913
  • Loading branch information
mauriciodesiderio committed Mar 17, 2021
1 parent e8f63b6 commit dcb0813
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
clientSpecific*.js
.clasp.json
2 changes: 1 addition & 1 deletion BulkdozerQA.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<br />
<button id='clearFeed' onclick='clearFeed()'>Clear Feed</button><br />
<button id='loadFromCM' onclick='qaCMLoad()'>Load from CM</button><br />
<button id='pushToCM' onclick='pushToCM()'>Push to CM</button><br />
<!--<button id='pushToCM' onclick='pushToCM()'>Push to CM</button><br />-->
<?!= include('runner'); ?>
<?!= include('sidebar'); ?>
<?!= include('logger'); ?>
Expand Down
5 changes: 5 additions & 0 deletions Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
const DEFAULT_SLEEP = 8 * 1000;
const DEFAULT_RETRIES = 4;

// Declare context object so we can call functions by name, this enables
// configuration based functionality, so the tool behaves according to settings
// defined in the sheet.
var context = this;

/**
* onOpen handler to display Bulkdozer menu
*/
Expand Down
2 changes: 2 additions & 0 deletions Fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var fields = {
'campaignName': 'Campaign Name',
'campaignStartDate': 'Campaign Start Date',
'campaignEndDate': 'Campaign End Date',
'billingInvoiceCode': 'Billing Invoice Code',

// Event Tag
'eventTagId': 'Event Tag ID',
Expand Down Expand Up @@ -89,6 +90,7 @@ var fields = {
'creativeType': 'Creative Type',
'thirdPartyUrlType': '3P URL Type',
'thirdPartyUrl': '3P URL',
'creativeActive': 'Creative Active',

// Ad
'creativeRotation': 'Creative Rotation',
Expand Down
25 changes: 18 additions & 7 deletions Loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
*
***************************************************************************/

// Declare context object so we can call constructors by name, this is used so
// we can define which concrete loader to use based on sheet configurations
var context = this;

/*
* Gets the profile id from the Store tab
*
Expand Down Expand Up @@ -786,6 +782,7 @@ var CampaignLoader = function(cmDAO) {
feedItem[fields.landingPageName] = landingPage.name;
feedItem[fields.campaignStartDate] = campaign.startDate;
feedItem[fields.campaignEndDate] = campaign.endDate;
feedItem[fields.billingInvoiceCode] = campaign.billingInvoiceCode;

return feedItem;
};
Expand Down Expand Up @@ -1786,17 +1783,31 @@ var CreativeLoader = function(cmDAO) {
if(feedItem[fields.creativeName]) {
creative.name = feedItem[fields.creativeName];
}

if(feedItem[fields.advertiserId]) {
creative.advertiserId = feedItem[fields.advertiserId];
}

if(feedItem[fields.creativeType]) {
creative.type = feedItem[fields.creativeType];
}

if(feedItem[fields.creativeActive]) {
creative.active = feedItem[fields.creativeActive];
}
}

/**
* @see CampaignLoader.postProcessPush
*/
this.postProcessPush = function(job) {
var campaign = cmDAO.get('Campaigns', job.feedItem[fields.campaignId]);
if(job.feedItem[fields.campaignId]) {
var campaign = cmDAO.get('Campaigns', job.feedItem[fields.campaignId]);

cmDAO.associateCreativeToCampaign(campaign.id, job.cmObject.id);
cmDAO.associateCreativeToCampaign(campaign.id, job.cmObject.id);

job.feedItem[fields.campaignName] = campaign.name;
job.feedItem[fields.campaignName] = campaign.name;
}
}
}
CreativeLoader.prototype = Object.create(BaseLoader.prototype);
Expand Down
10 changes: 2 additions & 8 deletions SidebarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,9 @@ function cmFetch(job) {
function _qa(job) {
doBuildHierarchy(job);

var qaMode = getSheetDAO().getValue('Store', 'B3');
var qaFunctionName = getSheetDAO().getValue('Store', 'B3');

if(qaMode == 'Aggregated Creative Rotation') {
qaByAdAggregatedCreativeRotation(job);
} else if (qaMode == 'Landing Page') {
qaLandingPage(job);
} else {
qaByCreativeRotation(job);
}
context[qaFunctionName](job);

// This is needed for large campaigns, it is too much data to transmit to the
// front end
Expand Down
12 changes: 7 additions & 5 deletions sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@
* returns false.
*/
function checkEntityMode(entityConfigs, entity, mode) {
if(entityConfigs && entityConfigs[entity].indexOf('WRITE') != -1) {
return true;
} else if(entityConfigs[entity].indexOf('READ') != -1) {
if(mode == 'READ') {
return true;
if(entityConfigs && entityConfigs[entity]) {
if(entityConfigs[entity].indexOf('WRITE') != -1) {
return true;
} else if(entityConfigs[entity].indexOf('READ') != -1) {
if(mode == 'READ') {
return true;
}
}
}

Expand Down

0 comments on commit dcb0813

Please sign in to comment.