What are Smart Quotes?

Smart Quotes are a special kind of quotation mark where the opening-quote and the closing-quote are visually different. Sometimes they are also known as “curly quotes”. In many typographic settings, this is preferred to the more mundane “straight quote”.

Notice how these quotes are slanted.

<script type=text/javascript>

Notice how these quotes are straight.

<script type="text/javascript">

What is the problem?

Smart quotes will break your ad tags.

An ad tag that contains accidental smart quotes will often just be blank. The good news is it’s very obvious that something is wrong. In more pernicious cases, the tag might contain a mix of smart-quotes and regular-quotes. In this situation, you may see the creative itself, but certain features may not work, such as animation, impression tracking, viewability tracking, or click tracking. This can be surprising because it looked okay.

Smart quotes are not valid javascript. In fact, if you have smart quotes in your code, you will get an error and the code won’t run. Unfortunately, unless you have good eyes or large fonts, they can be hard to spot. It can be maddening until you learn what to look for!

In nearly every case, accidental smart quotes will cause a “syntax error” in Javascript. If you open the Developer Console, you are likely to see this cryptic error message:

Uncaught Syntax Error: Invalid or unexpected token

In short, this means that the web browser does not understand your code and you need to eliminate the smart quotes to fix it. Note that smart quotes are one reason you will see this error message, but they’re not the only reason. Other syntax mistakes can cause this error too!

Where do smart quotes come from?

In the online advertising world, smart quotes can be introduced in several different ways, but three of these ways are especially common:

  1. Copy-pasting from a “rich” document format, such as Word, Excel, PDF or even a website
  2. Using the TextEdit application on OSX
  3. Using a CMS, such as WordPress

Yes, by default, TextEdit will automatically convert everything you paste into smart quotes – even if there were no smart quotes beforehand! WordPress can also be overly helpful sometimes, though the exact behavior depends on what theme and plugins you have installed. In the case of this blog, WordPress is automatically replacing my straight-quotes with smart-quotes (UGH!)

How can you find them?

Once you know that smart quotes are evil, there are a handful of techniques you can use to find and eliminate them.

Get a Programming Text Editor

The easiest and best way to find smart quotes is to paste the ad tag into a programming text editor that offers syntax highlighting for Javascript and HTML. The presence of smart quotes will be visually obvious because the colors will look wrong. These editors are highly customizable, but below is an example of what Sublime looks like out of the box.

sublimesyntaxhighlighting

These text editors offer powerful find-and-replace capabilities, so you can quickly replace all smart quotes with straight quotes. There are a LOT of very capable text editors out there, but here are three popular ones that you’ll be able to start using right away.

Increase Your Font Size

If you want to check quickly, you can just make the font huge. On OSX, you can press “CMD+” (command-key and plus-key) to increase the font size, and then CMD-0 (command-key and zero-key) to reset to the default.

Look for Console Errors

Learn to use the Javascript Developer Console to look for errors. Especially in cases where you have a mix of smart-quotes and regular-quotes, the creative might appear to work, while masking critical errors, such as a broken impression tracker. Checking the console for errors can help you identify and eliminate these types of problem.

Friends Don’t Let Friends Use TextEdit

TextEdit is not really made for editing code. Yes, you CAN edit code, but you’ll be much, much happier using a programming text editor instead. Just try Sublime for a day and you will never want to switch back. That said, if you insist on using TextEdit, you can save yourself a little bit of pain by permanently disabling smart quotes.

  1. Click TextEdit
  2. Click Preferences
  3. Uncheck “Smart Quotes”
  4. Open a New File

The updated preference does not take effect on the currently open files, so you will need to open a new file before it starts working. Also, the Preference does not apply to copy-pasted text. So if you paste a smart quote from another document, TextEdit will keep it. Setting the Preference prevents TextEdit from adding new smart quotes, but it won’t replace existing ones.

Drop Us a Line

We’re dedicated to working with the hungriest minds in our field. If you’re involved with digital content production or digital advertising and marketing, we’d love to hear from you. Big, small, experienced or beginner, please feel free to get in contact if you think we can be of service.

Say Hello