5 Common AdWords Script Mistakes
August 1, 2014
Despite its technical reputation, coding is a creative endeavor and offers a wealth of flexibility in solving problems. On the other hand, the language adheres to certain standards. Since a machine interprets code, you must follow certain protocols or risk non-working code. Even minor errors and typos can throw everything off and leave your code inoperable. Thankfully these are often small mistakes and quick changes. Today we will cover five of the most common errors.
The most common error you receive is a notification that you are attempting to use an undeclared variable. Alternatively, if you are using the same names with different capitalization (don’t do this!) you could inadvertently use the wrong variable in your functions.
The easiest way to avoid this problem is to use a standardized style. Most often this is accomplished by using camel case where the first letter of each word in the variable is capitalized, such as clicksToday. You could also use under scores, such as clicks_today. As long as you keep up the habit it will become natural and avoid many of these issues.
Brackets are similar to semi-colons, except they are used to encapsulate chunks of code, most often when building functions. When a script calls the function, everything within the brackets is executed. This has many benefits for both organization and code control but can present problems if you misplace them.
The two most common errors are missing and misplaced brackets. If you forget a bracket, the script may misinterpret the code within the function or may not run at all, giving you a missing bracket error. One of the benefits of the AdWords scripting interface is color-coding your brackets. If you click on a bracket that does not have a matching open or closing bracket, it will be highlighted in red. If it does have a closing bracket, it will be highlighted in green along with its partner.
Mixed Quotation Marks
The other likely scenario is if you are trying to include quotes in a string variable. For example you want to insert quotation marks into ad copy; to do that simply switch between them. Open with single quotes, insert double quotes and the text, and then close with single quotes. Just like this, ‘ “This is a quote example” ‘. This will interpret the double quotes as part of the text, rather than part of the code.
While working in the editor just take a look at the coloring. The string variable should be a consistent color and different than the rest of the code. If everything is highlighted like a string, or not enough, you made an error with a quotation.
Once you get beyond the basics of manipulating variables you’ll want to start playing with functions. Functions are confined pieces of codes that both organize code and help you with repeatable operations. For example rather than manually calculate ROAS or CPA you could define a function that you could simply reuse when needed, rather than write it out each time.
The easiest way to understand is that as the scope gets more specific, variables and data outside the scope are inherited but it does not necessarily work in reverse. If you initialize a variable inside a function, it will be private to that function. Not that you can’t use it somewhere else but you need to either return to another variable outside of the function. If you aren’t careful you may end up with results you are not expecting.
Browse By Category
Spotify Advertising: The Why and How
This blog post gives you the rundown on Spotify, including why and how you might advertise on Spotify's new self-serve ad platform, Ad Studio.
5 Facebook Ad Settings to Audit In Your Account
5 Easy settings to audit in your Facebook Ads account to improve performance and understand website traffic.
Analyzing the AdWords Distance Report
The distance report provides a unique view of your geographic data. The report helps users understand how distance from a location impacts search ad performance.
A bi-weekly newsletter packed full of resources and strategies that will help make you a better PPC expert.
Hanapin Marketing | The PPC Agency of Experts Behind PPC Hero
How to Master Attribution for Easy Budget Planning
In this webinar, Hanapin’s Cassie Oumedian and Google’s Julia Meter will provide tips on using AdWords attribution to directionally decide where you should allocate your budget, and how you can use the changing industry to your advantage.
Competitive Device Trends: An In-Depth Analysis
Explore how to pull a templated report that includes both device analysis and auction insights competitor data as well as recommendations!
AdWords Interface Updating By End of 2018
By the end of 2018, the old AdWords interface will be replaced by the new AdWords Experience permanently. The exact date of the transition is up for debate but it is expected to come as early as October, if not earlier in the year.