Tokens for Marketers
What they are and how Drupal marketers can (and should) use them to their benefit.
There are many benefits to using Drupal for your website, and there are a number of really excellent modules that can make marketers' lives easy. Today, I’d like to cover the basics of one crucial tool Drupal marketers should take advantage of: tokens.
Unfortunately in Drupal, tokens are not a form of currency received when accomplishing something in a game. However, after using them correctly and to their full potential, you may feel a sense of accomplishment. According to Drupal.org, “tokens are small bits of text that can be placed into larger documents via simple placeholders.”
When a piece of content utilizing a token is displayed, the token is replaced with information regarding what the token specifies -- and you can use tokens to easily retrieve and display data like a page title, summary, an author's twitter handle, and more. Due to the vast number of available tokens, they can be used throughout your entire Drupal website, increase productivity, and ultimately save you time and effort when putting content together. I will share a few basic examples of how tokens can be used, but remember, with so many tokens, the possibilities are essentially limitless. (Of course, you must have the tokens module installed and enabled on your Drupal website.)
Before we get started, though, I'd like to make a quck note: I have included extra spaces between the brackets in every example token that is displayed in this blog post. This is done so you can see the token; otherwise, without the spaces, the tokens would do their jobs and be replaced by it's respective text. So, remember: when you actually use tokens, make sure you take those spaces out.
While tokens are simple text that you put in to a field (such as your WYSIWYG or a metatag field), they can be similar to coding because the order of brackets and spaces matter. With one small mistake, tokens will not work. Here is what a basic token can look like:
[ node:title ] | [ site:name ]
I grabbed these tokens from the page title field on the edit screen from a blog post. So, when displayed (in the tab of the browser) the above brackets will be displayed like this:
Blog Title | Volacci Digital Marketing
The first set of brackets tells the Drupal website to replace ‘node:title’ with the specified title of the current node. It’s important to note that there are no spaces within the brackets themselves. The second set of brackets tells the website to replace ‘site:name’ with the name of the website. For this specific token, that will likely be the company’s name, not the domain name (volacci.com).
- Token: [ current-page:url:absolute ]
- How it will be displayed: https://www.volacci.com/blog/tokens-marketers
- How it works: Complex tokens use multiple semicolons to display different levels of drill-down. It's almost like a sentence, though it also sometimes helps to ‘read’ it in reverse. This token essentially says: “display the absolute form of the URL of the current page.” This may be quite obvious, but they can get lengthier.
- Where it could be used: This token (as with most) can be used in many places, but I grabbed it from the ‘Page URL’ field in the meta information for a Twitter Card.
- Token: [ node:author:url ]
- How it will be displayed: https://www.volacci.com/users/brian-solka
- How it works: This token says to display the URL of the author of the current node.
These are just two examples of tokens that can be used, but the posisibilities are endless. It's important to understand the concept of tokens because they can be applied over such a large spectrum of situations. Trying to name every different token in this blog post would be like listing colors; there are almost an unlimited number, but only few apply to a specific situation. Once you discover where you need them most, it will make many aspects of personalization and tedious setup a breeze.
In my next blog post on tokens, I'll be talking a little bit about the practical applciations of tokens. I'll be providing several examples of different situations tokens can be used in, and I'll show you how they dramatically save time for busy marketers. Until then, feel free to weigh in down in the comments section on whether you've used tokens yet and how they've changed your marketing workflow.