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

Commit

Permalink
Documentation updates, updating API version, and unifying QA and LP Q…
Browse files Browse the repository at this point in the history
…A tools

Change-Id: I4a5f209dbeb474156a4cfc2a1234a004dfd67d78
  • Loading branch information
mauriciodesiderio committed Mar 4, 2021
1 parent c645da6 commit d3e14bf
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 42 deletions.
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: 3 additions & 2 deletions CampaignManagerDAO.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ var CampaignManagerDAO = function(profileId) {
if(error && error.message) {
var message = error.message.toLowerCase();

return message.indexOf('user rate limit exceeded') != -1 ||
message.indexOf('quota exceeded') != -1;
return message.indexOf('internal error') != -1 ||
message.indexOf('user rate limit exceeded') != -1 ||
message.indexOf('quota exceeded') != -1;
}

return false;
Expand Down
2 changes: 0 additions & 2 deletions FeedProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ var FeedProvider = function(tabName, keys) {
});
}

console.log('this is the feed that was set:');
console.log(_feed.length);
return this;
}

Expand Down
4 changes: 0 additions & 4 deletions IdStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ var IdStore = function(sheetDAO) {
* Saves store to the sheet
*/
this.store = function() {
console.log('storing store');
console.log(store);
var raw = JSON.stringify(store);
var values = [];

Expand All @@ -96,14 +94,12 @@ var IdStore = function(sheetDAO) {

for(var i = 0; i < values[0].length && values[0][i]; i++) {
raw += values[0][i];
console.log(raw);
}

if(!raw) {
raw = '{}';
}

console.log(raw);
store = JSON.parse(raw);
}

Expand Down
28 changes: 28 additions & 0 deletions Loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ var LandingPageLoader = function(cmDAO) {
this.idField = fields.landingPageId;
this.listField = 'landingPages';
this.keys = ['Landing Page ID'];
var that = this;

BaseLoader.call(this, cmDAO);

Expand Down Expand Up @@ -866,6 +867,33 @@ var LandingPageLoader = function(cmDAO) {
return result;
}

/**
* @see BaseLoader.fetchItemsToLoad
*/
this.fetchItemsToLoad = function(job) {
var itemsToLoad = [];

forEach(job.campaignIds, function(index, campaignId) {
var campaign = cmDAO.get('Campaigns', campaignId);

if(campaign) {
var landingPages = cmDAO.list(that.entity, that.listField, {
'campaignIds': campaign.id
});

forEach(landingPages, function(index, landingPage) {
landingPage.campaign = campaign;
});

if(landingPages && landingPages.length > 0) {
itemsToLoad = itemsToLoad.concat(landingPages);
}
}
});

return itemsToLoad;
}

/**
* @see CampaignLoader.mapFeed
*/
Expand Down
30 changes: 29 additions & 1 deletion QA.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function qaByCreativeRotation(job) {
}

if(ad.type == 'AD_SERVING_CLICK_TRACKER' && ad.clickThroughUrl &&
ad.clickThroughUrl.computedClickThroughUrl) {
ad.clickThroughUrl.computedClickThroughUrl) {
feedItem['Landing Page Name'] = CLICK_TRACKER;
feedItem['Landing Page URL'] = ad.clickThroughUrl.computedClickThroughUrl;
}
Expand Down Expand Up @@ -272,3 +272,31 @@ function qaByAdAggregatedCreativeRotation(job) {

new FeedProvider('QA').setFeed(feed).save();
}

/**
* Implements the Landing Page QA style
*/
function qaLandingPage(job) {
if(!job.logs) {
job.logs = [];
}

job.logs.push([new Date(), 'Generating QA Report']);

var feed = [];

var cmDAO = new CampaignManagerDAO(getProfileId());

forEach(job.landingPages, function(index, landingPage) {
var feedItem = {};
feed.push(feedItem);

feedItem['Landing Page ID'] = landingPage.id;
feedItem['Landing Page Name'] = landingPage.name;
feedItem['Landing Page URL'] = landingPage.url;
feedItem['Campaign ID'] = landingPage.campaign.id;
feedItem['Campaign Name'] = landingPage.campaign.name;
});

new FeedProvider('QA').setFeed(feed).save();
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Bulkdozer Lite

- [Introduction](#introduction) <br/>
- [Installation](#installation) <br/>
- [Quickstart](#quickstart) <br/>
- [Terms and Conditions](#terms_and_conditions) <br/>
- [Support](#support) <br/>
Expand Down Expand Up @@ -38,6 +39,26 @@ these terms, please see below.

[Back to top](#top_page)

<a name="installation"></a>

## Installation

Use the links below to navigate to each one of the tools available. Refer to the
"Instructions" tab of each tool for details on how to deploy and use them.

- [Bulkdozer
Lite](https://docs.google.com/spreadsheets/d/14NkTLqoRO37uTrhWiG8H7kp3yhNEmuOujy_qSTS4YDo)
- [QA
Tools](https://docs.google.com/spreadsheets/d/10b00Gu2n2exBkeGKoVK67u5GPf88eOzma3kWXO14XMQ)
- [Event Tag QA
Tool](https://docs.google.com/spreadsheets/d/1Pj4DqHibkTSoo6zQGDpksxpnxyhojNa3pBkMAvX0p6A)
- [Landing Page QA Tool &
Editor](https://docs.google.com/spreadsheets/d/15b5rHLZJq5-ddnbsyfOzuK2I3oGeSzxKjL-qdwwfnn8)
- [Key Value
Editor](https://docs.google.com/spreadsheets/d/1OnYlrGXN4bck9y4xnfzbr8WtEtINMRdyxjbV4wlOTn8)
- [Cost
Editor](https://docs.google.com/spreadsheets/d/1o91F9acD1ACPBhXIufgDz8QfOuEU_GLLLBTT1Ok5f8w)

<a name="quickstart"></a>

## Quickstart
Expand Down
4 changes: 4 additions & 0 deletions SidebarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ function cmLoad(job) {
* job.parentItemIds ids of parent items to load child items for
*/
function _cmFetch(job) {
console.log("fetching: ");
console.log(job.entity);
var loader = getLoader(job.entity);

job.itemsToLoad = loader.fetchItemsToLoad(job);
Expand Down Expand Up @@ -136,6 +138,8 @@ function _qa(job) {

if(qaMode == 'Aggregated Creative Rotation') {
qaByAdAggregatedCreativeRotation(job);
} else if (qaMode == 'Landing Page') {
qaLandingPage(job);
} else {
qaByCreativeRotation(job);
}
Expand Down
2 changes: 1 addition & 1 deletion appsscript.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"enabledAdvancedServices": [{
"userSymbol": "DoubleClickCampaigns",
"serviceId": "dfareporting",
"version": "v3.3"
"version": "v3.4"
}]
},
"exceptionLogging": "STACKDRIVER",
Expand Down
90 changes: 59 additions & 31 deletions sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@
* returns false.
*/
function checkEntityMode(entityConfigs, entity, mode) {
if(entityConfigs && entityConfigs[entity]) {
if(entityConfigs && entityConfigs[entity].indexOf('WRITE') != -1) {
return true;
} else if(entityConfigs[entity] == 'READ') {
} else if(entityConfigs[entity].indexOf('READ') != -1) {
if(mode == 'READ') {
return true;
}
Expand Down Expand Up @@ -535,7 +535,16 @@
return new Runner().run('initializeJob', [{}]).then(function(result) {
console.log('Starting job: ' + result[0].jobId);

return identifyItemsToLoad();
}).then(function(result) {
return new Runner().run('getEntityConfigs', [{}]);
}).then(function(result) {
var entityConfigs = {};

if(result.length > 0 && result[0].entityConfigs) {
entityConfigs = result[0].entityConfigs
}

return identifyItemsToLoad(entityConfigs);
}).then(function(result) {
return new Runner().run('clear', [{
'sheetName': 'QA',
Expand All @@ -558,41 +567,61 @@
logger.log(jobs);

var jobsMap = getJobsMap(jobs);
disableJobs(jobs);

jobsMap['EventTags'].run = true;
if(jobsMap['EventTags']) {
disableJobs(jobs);
jobsMap['EventTags'].run = true; // the problem is in this line

jobsMap['EventTags'].adIds = [];
forEach(jobsMap['Ads'].itemsToLoad, function(index, item) {
jobsMap['EventTags'].adIds.push(item.id);
});
jobsMap['EventTags'].adIds = [];
forEach(jobsMap['Ads'].itemsToLoad, function(index, item) {
jobsMap['EventTags'].adIds.push(item.id);
});

jobsMap['EventTags'].campaignIds = [];
forEach(jobsMap['Campaigns'].itemsToLoad, function(index, item) {
jobsMap['EventTags'].campaignIds.push(item.id);
});
jobsMap['EventTags'].campaignIds = [];
forEach(jobsMap['Campaigns'].itemsToLoad, function(index, item) {
jobsMap['EventTags'].campaignIds.push(item.id);
});

jobsMap['EventTags'].preFetchConfigs = [
{
'entity': 'Campaigns',
'listName': 'campaigns',
'filterName': 'ids',
'fieldName': 'campaignId'
}
];
jobsMap['EventTags'].preFetchConfigs = [
{
'entity': 'Campaigns',
'listName': 'campaigns',
'filterName': 'ids',
'fieldName': 'campaignId'
}
];

return new Runner().run('cmFetch', jobs);
return new Runner().run('cmFetch', jobs);
} else {
return jobs;
}
}).then(function(jobs) {
setStatus('Generating QA Report');

var jobsMap = getJobsMap(jobs);
var hierarchyJob = {
'campaigns': jobsMap['Campaigns'].itemsToLoad,
'placements': jobsMap['Placements'].itemsToLoad,
'placementGroups': jobsMap['PlacementGroups'].itemsToLoad,
'ads': jobsMap['Ads'].itemsToLoad,
'landingPages': jobsMap['AdvertiserLandingPages'].itemsToLoad,
'creatives': jobsMap['Creatives'].itemsToLoad,
'eventTags': jobsMap['EventTags'].itemsToLoad

var hierarchyJob = {};

if(jobsMap['Campaigns']) {
hierarchyJob['campaigns'] = jobsMap['Campaigns'].itemsToLoad;
}
if(jobsMap['Placements']) {
hierarchyJob['placements'] = jobsMap['Placements'].itemsToLoad;
}
if(jobsMap['PlacementGroups']) {
hierarchyJob['placementGroups'] = jobsMap['PlacementGroups'].itemsToLoad;
}
if(jobsMap['Ads']) {
hierarchyJob['ads'] = jobsMap['Ads'].itemsToLoad;
}
if(jobsMap['AdvertiserLandingPages']) {
hierarchyJob['landingPages'] = jobsMap['AdvertiserLandingPages'].itemsToLoad;
}
if(jobsMap['Creatives']) {
hierarchyJob['creatives'] = jobsMap['Creatives'].itemsToLoad;
}
if(jobsMap['EventTags']) {
hierarchyJob['eventTags'] = jobsMap['EventTags'].itemsToLoad;
}

return new Runner().run('qa', [hierarchyJob]);
Expand Down Expand Up @@ -936,7 +965,6 @@
}
});
}).then(function(result) {
console.log(result);
var idMap = result.idMap;
var entityConfigs = {};

Expand Down

0 comments on commit d3e14bf

Please sign in to comment.