Learning to code is similar to learning to drive. It opens up a world of opportunities.

From a marketer's point of view the ability to interpret, edit and write code is an incredibly useful skill to add to your toolkit.

What can you do with such abilities?

  • Understand / troubleshoot technical on-site issues from an SEO perspective
  • Create your own content
  • Complete small tasks which you normally sent across to developers 
  • Build your own tools, scripts and apps
  • Start your own business!

How can I learn?

There are many resources available to help you learn. I recommend the following more interactive resources:

  • Codecademy. Learn to code interactively for free. Good learning curve.
  • Treehouse. 1,000's of videos with interactive challenges and member forum for a low monthly price.

Build your own simple keyword tool

You've heard of Ubersuggest right? It’s a popular keyword suggestion tool using data from Google suggest.

Did you know that Ubersuggest has an API (application programming interface) so you can use the same keyword data to create your own keyword tool?


Using PHP I'm going to help you create your own simple keyword tool. If you’re new to PHP I'd recommend taking the HTML (Hyper Text Markup Language) and PHP (Hypertext Preprocessor) lessons on Codecademy first.

Let's get some admin out of the way.

  1. Sign up for a free Mashape account to access the API marketplace.
  2. Subscribe to Ubersuggest. This gives you 10 free queries per day and will charge you $0.05 per additional query.
  3. Click the 'key' symbol in the top navigation. Next to 'Production Keys' click 'Create Key'. In the newly appearing box click the header to give it a more memorable name. Copy the long key for future use in your tool.

    Just below the API key you will see a search box which allows you to search for an API from which you have previously subscribed. Search for your 'Ubersuggest' and it should appear as an option. Click on this. This will link this API to your newly created key.

  4. Within the documentation for their API we will use the 'suggest' endpoint. This returns a simple set of keyword suggestions for a given search term.

Now to the exciting bit!

Open a new file within your favourite web editor (Notepad++ is ideal). Look at the code snippet below (the text version of this can be found here - simply copy and paste the entire PHP code snippet into your new file). Save it as a PHP file (.php). We will break down the PHP code into four sections and go through each.

  1. Keyword Settings. To gather keyword suggestions we will need to provide the API with four options:
    1. Keyword. This is the keyword that you want to find related keywords for. In our example above I’ve added "new homes" as the keyword (please experiment by adding your own). This is then saved in the PHP variable $keyword.
    2. Language. You can add an ISO language code to tailor the keyword results to a specific language. In the example we have set the language PHP variable ($language) to "en" (English).
    3. Country. You can add an ISO country code to tailor the keyword results to a specific country. In the example we have set country PHP variable ($country) to "us" (United States).
    4. Source. The Ubersuggest API allows you to gather results from one of four Google channels. These are web, image, shopping and video. In the example we have set the source PHP variable ($source) to “web”.
  2. This is where you will add the Mashape API key you created earlier. This will save the API key to the PHP variable $api_key.
  3. This section looks at the API call which will send a request to Ubersuggest and return keyword results for your keyword tool.
    1. The API call requires access to Unirest PHP library. This can be downloaded here (click 'Download ZIP' on the right hand side).
    2. The value assigned to the $response variable constructs the API call based on your keyword settings in section 1. $response will hold the returned data from the API call.
  4. We have the results in a raw format. We now need to do something with this and present it on screen in a readable format.
    1. An IF statement checks if there if there are results stored in the $response variable. If this is false then the message "No Keywords Found" will be displayed on screen.
    2. If true, a FOREACH function will loop through all the individual keywords and display them on-screen in a bulleted list.

Don’t forget to save your file. Upload to a PHP supported web host once ready. Unzip the 'lib' folder from the Unirest PHP library you downloaded earlier (step 3a) and upload it to the same directory as your new PHP file. Running the file in your web browser will display something like the following:

Keyword Results

You've now got a list of relevant / trending keywords using Google suggest data.

That’s it! You’ve built your own keyword tool. Start experimenting with the code to learn and do your own thing with the data. Experiment with the many other APIs on Mashape at your own pace. Sentiment analysis? Face recognition? It’s all possible!

Matthew Redford

Published 22 January, 2014 by Matthew Redford

Matthew Redford is Digital Marketing Executive at Extreme Creations and a contributor to Econsultancy. You can follow Matthew on Google Plus.

2 more posts from this author

You might be interested in

Comments (6)

Save or Cancel


Just wanted to let you know you wrote print "<ul>" twice when the last one was supposed to be print "</ul>" to close the unordered list. Other than that, glad to see an easy to follow article about programming basics for marketers !

over 4 years ago

Matthew Redford

Matthew Redford, Digital Marketing Executive at Extreme Creations Ltd

Thanks Justin! I could say that I left this in as a test... However it is a mistake so I'll see if I can update the image.

over 4 years ago


Deri Jones, CEO at SciVisum Ltd

<contrarian mode on>

I love marketers and technologists - I'm in both camps myself after all!

But I wonder if your article is not rather patronising to both groups.

> Learning to code is similar to learning to drive. It opens up a world of opportunities.

No it's not like driving.
Fundamentally different.
99% of the population can with a small amount of practise learn to drive.

Whereas we have 2 specialist professions: marketing and software development: which require character strengths and ways of thinking that 99% of people don't have! That's why both professions earn above the national wage!

And in any job: you find, on average, that people share a common set of strengths: which are different between professions.

So on average, the typical marketer doesn't have the abstract thinking style that is required to be a software developer. (but a few do)

Likewise, most coders (on average) don't have the strengths needed to be a good marketer. (but a few do)

Just like (on average) the strengths needed to be a professional sales person or a doctor or a nurse are different to the 2 professions above.

So Instead of saying:
> Learning to code is similar to learning to drive. It opens up a world of opportunities.

I wonder if this may be more accurate:

"Learning to code properly is a serious profession and requires a range of innate strengths that most people do not have. For those that can do it, it opens up a world of opportunities.

"The average Marketer does not have those innate, abstract thinking strengths needed to be a coder - so there is no shame in leaving it to the professionals in your company!

"However, if you are a marketer with more of an abstract thinking brain that most - which may be evidenced perhaps by you having become proficient at more complex spreadsheet formulas - then why not try your hand at some simple coding tasks: and see how you get on?

"It can be fun and useful.
" But set your expectations: unless you really do have an advanced abstract thinking approach, then be realistic and except that it will take you 10 hours to achieve something in code that your professional coding colleagues could do in 1 !

After all, the coding professionals also have training and experience too, that you don't.

Just like - if you're not a trained car mechanic, it will be higher ROI for you to let them fix your car: and you to earn bigger returns using your strengths and training and experience in marketing.

But having said all that - if you're up to learn some programming - go for it! It's definitely fun and rewarding!

<contrarian mode off>

over 4 years ago



Everyone should learn to code at least at a basic level. Just like we are taught to read and write. It doesn't mean everyone will be able to solve complex software problems but, as Matt rightly says, it will open up doors of opportunity, not just in marketing.

So, to use your analogy Deri, I am not a car mechanic but I can change a flat tyre and fill up the windscreen wash. Maybe a mechanic can do that more quickly but it’s good for me to have the understanding and ability to do it myself.

A useful article. Thanks Matt.

over 4 years ago



Unlike Deri, I didn't read this as "how to replace your web developer" or become a "serious" programmer so-to-speak, but a good demonstration of how getting stuck in and playing around with a bit of code and an API can produce quick and easy results and is fun to do!

I feel coding *is* something that anybody can teach themselves to do - in fact, you'll find the majority of coders are self-taught (at least initially) and started by experimenting and playing with code in the very same way. If you're curious and want to play around to see what is possible, this article is a great example of how to go about that... and I say, go for it - don't be intimidated by "professionals" trying to put you off... have a play and see what you can do.

"Serious" programming however does of course involve lots of skills and expertise that you cannot pickup simply by following a few tutorials... but I think we all know that and I don't think Matt was suggesting otherwise.

over 4 years ago


Deri Jones, CEO at SciVisum Ltd

I'll leave my contarian mode off this time!

> If you're curious and want to play around to see what is possible, this article is a great example of how to go about that..

Spot on - those with curiosity - we should encourage all the way.

over 4 years ago

Save or Cancel

Enjoying this article?

Get more just like this, delivered to your inbox.

Keep up to date with the latest analysis, inspiration and learning from the Econsultancy blog with our free Digital Pulse newsletter. You will receive a hand-picked digest of the latest and greatest articles, as well as snippets of new market data, best practice guides and trends research.