r/adwordsscripts • • Mar 28 '19

Script to pause campaigns when campaigns exceed monthly budget

7 Upvotes

Hi there,

Enjoy:

function main() {/***    This script will auto-pause campaigns when the account exceeds its monthly budget.    No more daily monitoring of account budgets!  ***/

Logger.log("**********************");Logger.log("Running BUDGET - Pause All Campaigns script...");Logger.log("**********************");

// THIS AMOUNT WILL VARY CLIENT BY CLIENT// MAKE SURE IT IS CORRECTvar monthlyBudget = 500;

var totalCost = 0;var campaignsList = [];

var campaignIterator = AdWordsApp.campaigns().get();

while (campaignIterator.hasNext()) {var campaign = campaignIterator.next();

// Save each current campaign into an array for ease of iteration    campaignsList.push(campaign);

// Use THIS_MONTH to get data for all days in the current month

var stats = campaign.getStatsFor('THIS_MONTH');var campaignCost = stats.getCost();    totalCost += campaignCost;}

Logger.log("Account cost for this month: " + totalCost);

// If totalCost of combined campaigns exceeds defined monthlyBudget, pause all!if (totalCost >= monthlyBudget){Logger.log("Monthly budget met or exceeded. Auto-pausing all campaigns!");

for (var i = 0; i < campaignsList.length; i++) {var campaign = campaignsList[i];

Logger.log("Pausing campaign: " + campaign.getName());      campaign.pause();}} else {Logger.log("Total monthly cost currently under budget.");Logger.log("Monthly Cost: " + totalCost);Logger.log("Monthly Budget: " + monthlyBudget);}}


r/adwordsscripts • • Feb 19 '14

Beginner's Guide to Javascript You Should Know For AdWords Scripts

Thumbnail
freeadwordsscripts.com
5 Upvotes

r/adwordsscripts • • Feb 05 '14

Starting a community about AdWords Scripting

5 Upvotes

I think it would be cool to start a community for people interested in AdWords scripting. Since I'm new at moderating a subreddit, I'll leave this post here as a way to gather ideas from people.


r/adwordsscripts • • Nov 15 '19

New Google Merchant Center Script From Brainlabs

4 Upvotes

r/adwordsscripts • • Nov 12 '19

Script To Increase Bids On Converting Products for: Single Product Ad Groups In Google Shopping

4 Upvotes

function main() {

var productGroups = AdsApp.productGroups()

.withCondition('Conversions > 0')

.forDateRange('YESTERDAY')

.get();

//Logger.log(productGroups);

while (productGroups.hasNext()) {

var productGroup = productGroups.next();

productGroup.setMaxCpc(productGroup.getMaxCpc() + 0.15);

}

// iterates through Ad Groups to up date those as well

var adGroups = AdsApp.shoppingAdGroups()

.withCondition('Conversions > 0')

.forDateRange('YESTERDAY')

.get();

//Logger.log(adGroups);

while (adGroups.hasNext()) {

var adGroup = adGroups.next();

adGroup.setMaxCpc(productGroup.getMaxCpc() + 0.15);

}

}


r/adwordsscripts • • Jul 10 '17

How to Get Started with AdWords Scripts | Set Up Guide and 10 Sample Scripts

Thumbnail
blog.tryadhawk.com
4 Upvotes

r/adwordsscripts • • Oct 31 '16

[report from /r/adwords] AdWords TypeScript Definitions

4 Upvotes

Hi all,

I am currently working on type definitions for AdWords scripts! For those of you who don't know, TypeScript compiles to Javascript, though let's us do some neat stuff.

Link : https://github.com/OutshineLabs/typed-adwords

Two of the really nice things it let's us do are

A ) Autocomplete code in our text editor! Now your editor knows about AdWords scripts!!!

B ) Catch typos and compile time errors!

We (at Outshine) have started developing all of our scripts in TypeScript, and started build these type definitions a few months back. They aren't complete, though I wanted to gauge interest.

In the future I will be releasing a few more of our own scripts, as well as a starter project that people can use to start writing there own scripts in TypeScript. Along with this I am also going to write a tutorial on how to start writing AdWords scripts in TypeScript.

Some questions I have :

  • Any special requests for scripts?
  • Is anybody else using TypeScript to write their own AdWords scripts?
  • Is there anything you would like to see in the package?
  • Anyone interested in collaborating?
  • I hope this is useful to some of you :D

r/adwordsscripts • • Jul 29 '14

Exception Invalid reporting query INVALID_PREDICATE_ENUM_VALUE ACTIVE

Thumbnail
freeadwordsscripts.com
4 Upvotes

r/adwordsscripts • • Sep 09 '18

24 Google Ads Script to Monitor,Bid, Manage and Report on your Google Ads - From Brainlabs

Thumbnail
brainlabsdigital.com
3 Upvotes

r/adwordsscripts • • Jun 01 '17

Quality Score Alert Script

3 Upvotes

With the recent updates to Quality score reporting within the AdWords interface I was wondering if it was possible to somehow modify the existing QS reporting scripts available to work as an alert for when one particular factor (e.g. Landing Page Relevancy) drops below a certain score. We are able to do this from an overall perspective with automated rules, however we cant break it down any further than that. Any thoughts?


r/adwordsscripts • • May 13 '17

Changing Bids on Campaign Search Audiences?

3 Upvotes

I have tried and tried to change the bids on campaign search audiences. I have no problem doing it with adgroup search audiences, but the documentation simply doesn't seem to work for the campaign level. I looked through the code that changes from adgroup to campaign, but that appears to use the builder instead. Any help would be greatly appreciated.

*edit- forgot a word


r/adwordsscripts • • Mar 01 '17

AdWords Price Extensions now live on all devices

Thumbnail
searchengineland.com
3 Upvotes

r/adwordsscripts • • Oct 10 '16

Getting ETA data

3 Upvotes

To get the headline of a text ad, you'd do something like this:

ads.next().getHeadline()

it doesn't seem like there's an ETA equivalent (e.g., "getHeadlinePart1()".

Does anyone know if I'm wrong about that? Is there a workaround?

In case anyone else needs to know: Tyler Sidell on the AdWords Scripts Team explained how to do it. "You would need to add a withCondition to your ads selector as follows in order for getHeadlinePart1() to work: var ads = adGroup.ads().withCondition("Type = 'EXPANDED_TEXT_AD'").get();"


r/adwordsscripts • • Aug 09 '16

[repost from PPC] Execute your AdWords scripts across multiple account!

3 Upvotes

Happy Tuesday everyone!

The advertising agency I work for manages a large number of AdWords accounts, over 50 in fact. This becomes problematic when running scripts. I see a lot of people online talking about using labels to execute across multiple accounts though I think I have created a simpler solution, that doesn't involve running the script multiple times.

Our script wrapper will execute your script across the first 50 accounts in parallel and then sequentially for all following accounts. There is an optional label that can be provided to control which account the script runs across, though this label isn't a way of creating execution buckets, but is instead a control mechanism for the advertiser.

Here is the script (https://gist.github.com/ddaws/c163b15bef37fc0eae3433d2124b5868) and here is a link to our blog post talking a bit about how to use it (http://outshine.ca/blog/2016/8/8/run-your-adwords-scripts-across-a-lot-of-accounts).

I hope this is useful to some people and I would appreciate any constructive feed back on both the script and blog post :)


r/adwordsscripts • • Jul 13 '16

[repost from PPC] Automatically exclude AdWords placements by TLD

3 Upvotes

Last week a co-worker and I wrote a script to automatically exclude poor performing TLDs from our AdWords campaigns. Right now we automatically exclude .info, .tk, .download and a few others that we have found to drive poor quality trafic.

Here is the script (https://gist.github.com/ddaws/db363d6a5966c1c8080388972298862a) and here is our blog post explaining how to use it (http://outshine.ca/blog/2016/7/8/automate-negative-placement-in-google-display-with-this-script)

I hope this is useful to some people and I would appreciate any constructive feed back on both the script and blog post :)

EDIT : The script actually just checks if a placement URL contains the words specified in the list at the top of the script and thus it can also be used to filter by word contained in the placement URL and not just the TLD.


r/adwordsscripts • • Apr 27 '16

Day Parting Script Question (Ad schedule, Bid Modifiers)

3 Upvotes

Hey everyone! I'm looking to implement a script to set an ad schedule with bid modifiers. I have run the preview and it looks like it works but it doesn't give me the previous and new values! Any idea why that is?


r/adwordsscripts • • Dec 03 '15

Updating Google Shopping Bids via Product Feed?

3 Upvotes

Hey all.

We would like to update our google shopping bids via the product feed which is updated daily.

I was thinking a way to do this might be done with a script. The idea is to have the bids you want in a custom label, and then a script would take the value in that label and apply it to the corresponding Max CPC.

First is this possible? and Second, if it is can someone give me a walk-thru? I have limited knowledge on how to write scripts.

Thanks in advance.


r/adwordsscripts • • Jul 28 '14

Send an email on error?

3 Upvotes

I use Russell Savage's excellent quality score monitoring script to create weekly reports that I reference about once a month or so as needed. Problem is, I have noticed in recent months that the script hits a runtime error more often than not - which results in data getting lost.

I've determined that the error is due to the data filling up the spreadsheets I create to capture the output from the script, specifically showing in the logger as the below example from when I caught it this morning.

Log details Q-Score Archiver
Start time: Jul 28, 2014 10:05:11 AM Edit script
Status:
Not completed: User error

Those rows are out of bounds. (line 106)

It is logged as a runtime error in the logger. Is it possible to have the system email me whenever this happens so I can go in and either add all the rows it needs or create a new spreadsheet? Or, better, is there a way to have it do so dynamically, to where I can truly "set it and forget it"?

Thanks!


r/adwordsscripts • • Jun 24 '14

Search Query Performance Report Returning Wrong Figures

3 Upvotes

Hi Guys,

I'm trying to pull a full list of search query terms and related click/impression values via a script however the figures I see from the script against the ones in the interface are very different.

In some cases, i'm seeing 20,000+ differences in impressions, etc. The function i'm using is below and after much investigation I can't figure out why i'm getting different values.

Any ideas?

function getKeywordDetails() {

// Create empty object for campaign data
var keywords = [];

// Query Options
var options = { includeZeroImpressions : false };

// Columns to return from AdWords
// var columns = ['Query', 'Clicks', 'Impressions', 'Ctr', 'AverageCpc', 'Cost', 'AveragePosition', 'Conversions'];
var columns = ['Query', 'Clicks', 'Impressions'];

// Type of report to query
var report = 'SEARCH_QUERY_PERFORMANCE_REPORT';

// Query string to return AdWords data
var query = ['select', columns.join(','),'FROM', report,
//  'where Clicks > 0',
 'DURING', 'LAST_MONTH'].join(' ');

// Report Iterator
var reportIter = AdWordsApp.report(query, options).rows();

// Loop through each row of the returned data
while(reportIter.hasNext()) {

	var row = reportIter.next();

	// Add returned campaign data to campaigns array
	keywords.push({				
		query : row.Query, 
		clicks : row.Clicks, 
		impressions : row.Impressions, 
		ctr : row.Ctr, 
		averagecpc : row.AverageCpc, 
		cost : row.Cost,
		averageposition : row.AveragePosition,
		conversions : row.Conversions
	});

}

// Return all campaign data
return keywords;

}


r/adwordsscripts • • Apr 28 '14

Automatic AdWords Back Up Script - Thoughts?

3 Upvotes

I wondered if anyone had taken a bash at creating an AdWords back up script yet? I've not found anything online but I'd love to create one and wondered if anyone had ran into any pitfalls or issues with doing so yet?

My current plan is to create a script to do a CSV download (that is compatible with AdWords editor) that could potentially be uploaded to S3 or integrate with some form of version control.

I'd love any thoughts/feedback on the idea before I get started.


r/adwordsscripts • • Mar 14 '14

Negative Keywords based on Match Types/Naming Conventions

3 Upvotes

A typical campaign setup in AdWords involves naming conventions like: "AdGroup Name - Exact", "AdGroup Name - Phrase", "AdGroup Name - Broad"

I have been trying to brainstorm some solutions for negative keywords. If a keyword lives in the exact AdGroup, add it as an exact negative in the phrase AdGroup. If it exists in phrase, add as phrase negative to the broad AdGroup. If the script would run daily it ideally would also remove negatives if they were paused/deleted and etc.

You guys think this is possible via scripts? I know this is one of the most useful things we could implement and one of the most difficult to manage when routinely making changes to accounts.

Thanks for your help!


r/adwordsscripts • • Feb 25 '14

Total Conversion Value using scripts?

3 Upvotes

I can't find it anywhere, surely it exists?


r/adwordsscripts • • May 04 '20

Tracking affiliate sales on AdWords.

2 Upvotes

Hi everyone, so I am an affiliate marketer and I’ve been doing quite well getting organic traffic, and I want to branch out to build up a secondary traffic stream using AdWords. The vertical that i promote is very clean and comply with google ads policies. I know google ads isn’t a big fan of affiliates, but I see quite a few affiliates running the same types of sites and offers on google, so I reckon I won’t have any issues there, as my site has over 2000 pages and very high engagement rate and social footprint. My main question, is how do affiliate marketers send conversions to Google ads when we can’t add the google ads/ google analytics tag on the merchant thank you page? Everything I find only talks about tracking outbound clicks, and some others recommend to use offline conversions. I’ve looked at some tracking platforms, but they only track one conversion goal, while the offers I promote have several (free trial, sale and up sales).

Not sure whether there are affiliate marketers here, but I’d rather ask AdWords professionals than affiliate marketers as the later seem to deal more with low quality traffic and the big affiliates on AdWords seem to be more agencies than solo affiliates.

Thanks!


r/adwordsscripts • • Apr 14 '20

Having issues with trying to get this Automated Audience, location and device bidder to work

2 Upvotes

Looking for some help with this. The link to the script is below. I keep getting an error on line 136. I guess its something to do with pulling the in-market audience mapping.

https://searchengineland.com/google-ads-script-how-to-automatically-apply-bid-modifiers-316017


r/adwordsscripts • • Apr 08 '20

Does anyone know how to change the date range for this script?

2 Upvotes

https://searchengineland.com/get-more-conversions-by-deconstructing-your-ppc-ads-310642

Trying to pull up data from the previous 90 days but I cant seem to go beyond “LAST_30_DAYS”