Upload
sean-malseed
View
1.017
Download
4
Embed Size (px)
Citation preview
MAKE YOUR
OWN DAMN
SEO TOOLS
@seanmalseed
Cheat Sheet: ranktank.org/damntools/
Why?
• How many hours have you spent trying to find that one tool
that did that one thing that
you need?
• How many hours do you spend fiddling with multiple exports
from three tools trying to eek
out some information?
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
“but i dont know how to code and im really
not that technical…”
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
If you’re sitting in this room right now,
you’ve got a little technical in you.
Give yourself a little credit.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Talkin’ Bout some GDocs
• ImportXML and
ImportDATA can
automagically pull
and parse data from
an API or web pages.
• ImportHTML can pull
web page source
elements
Google built some really powerful commands
into Sheets.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
ImportDATA
• PowerPoint can get a little
boring, so let’s build a tool
right now.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Multi-Page Change Monitor
• The “Have they updated their website
or code yet?” tool.
• Formula used: ImportDATA
• Google Doc with Example
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Setting Up the Sheet
• Column A is for the URLs you’ll be checking
• Column B is for the live pages pulled from the site
• Column C is for the original pages to compare against
• Column D performs the “Has it changed?” check!
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
• Column B is where the real
magic happens, pulling live
data for each page you put in
column A using importDATA
• Let’s build that formula
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
=importdata(A2)
This call uses the URL in cell A2 and pulls all of the page source.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
=concatenate(importdata(A2))
Concatenate joins an array together. In this case, it forces all of the code into a single string of data in one cell.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
=substitute(concatenate(importdata(A2)), char(10), “”)
Some pages still have line breaks which cause the sheet to get all weird and stuff. Stop this weirdness by using SUBSTITUTE to replace line breaks Char(10) with nothing “”
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
=if(A2)=“”,””, substitute(concatenate(importdata(A2)),
char(10), “”))
Finally, to keep the sheet clean, we need to check and see if something is actually in cell A2. If nothing is there, we’ll leave B2 blank too.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
The Magic Formula
=if(A2)=“”,””, substitute(concatenate(importdata(A2)),
char(10), “”))
Finally, to keep the sheet clean, we need to check and see if something is actually in cell A2. If nothing is there, we’ll leave B2 blank too.
If the value in A2 = empty Make this cell (B2) empty
Otherwise, do the thing!
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Column D for Detection!
=if(B2=C2,”Nope”,”Yep”)
Compare the live data in B2 to the baseline data in C2.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Column D for Detection!
=if(C2=“”,””,if(B2=C2,”Yep”,”Nope”))
Cleaning this up a bit: if we didn’t put baseline data in C2, there’s no reason to do
the comparison! We’ll leave the cell blank instead.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Using an API
• The “I just need effing keyword
search volumes in bulk but SEMrush
doesn’t do that” tool.
• API used: SEMrush
• API call used: phrase_this
• Formula used: ImportDATA
• Google Doc with Example
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
SEMrush API Format
Looks complicated, but it’s not.
http://us.api.semrush.com/?action=report&type=phrase_this&key=YOUR_API_KEY&display_limit=1&export=api&export_columns=Nq&phrase=KEYWORD
Using the API is literally just calling a URL with your API key in it.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
SEMrush API Format
Let’s break it into multiple lines
and examine it.
http://us.api.semrush.com/?action=report <- Required, specify country
&type=phrase_this <- This specifies the type of call you’re making
&key=YOUR_API_KEY <- Your API key goes here
&display_limit=1 <- How many lines of data to get. We only need one!
&export=api <- Required
&export_columns=Nq <- What metrics do we want? Nq means Search Volume
&phrase=KEYWORD <- The keyword to check. Pretty important to include…
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Making the Call
We’ve already learned how to use
importDATA!
=importdata(http://us.api.semrush.com/?actio
n=report&type=phrase_this&key=YOUR_API_KEY&d
isplay_limit=1&export=api&export_columns=Nq&
phrase=KEYWORD)
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Making the Call
=importdata("http://us.api.semrush.com/?acti
on=report&type=phrase_this&key=YOUR_API_KEY&
display_limit=1&export=api&export_columns=Nq
&phrase=“ & A2)
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Uh-oh…
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
API column header
The actual data we want
The API returns TWO lines of data, when we only want one! It gives us a columnheader AND the data we want, which wind up taking two rows. This won’t workif we want to check multiple lines of keywords!
The Magic of QUERY
Google built a function called “QUERY” into
Sheets, and it’s basically effing magic.
QUERY let’s you perform an SQL query on
data, such as a range of cells or returned
data.
SQL stands for Structured Query Language,
but it might as well mean Simple Query
Language because it’s simple as sh*t.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Let’s QUERY
We’re gonna perform this “QUERY” on the data
the SEMrush API sends us:
SELECT Col1 LABEL Col1 ‘’
It’s going to SELECT column 1 and LABEL
column 1 with ‘’ (meaning blank). BOOM the
header is GONE BABY!
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
ImportDATA + Query
=query(importdata("http://us.api.semrush.com/?action
=report&type=phrase_this&key=5311a58529cc0bbadf7e277
555e9d83b&display_limit=1&export=api&export_columns=
Nq&phrase=" & A2),"SELECT Col1 LABEL Col1 ''")
Boy oh boy, is that easy to do.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Gettin’ International
=query(importdata("http://” & $E$2 &
“.api.semrush.com/?action=report&type=phrase_this&key=5311
a58529cc0bbadf7e277555e9d83b&display_limit=1&export=api&ex
port_columns=Nq&phrase=" & A2),"SELECT Col1 LABEL Col1
''")
Cell E2 will hold the country code, and using the $
(as $E$2) means the cell position will never change,
even when the formula is pasted or filled-down.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Using XPath
• The “I need to check all of the meta
descriptions and page titles” tool.
• Formula used: ImportXML
• Google Doc with Example
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
XPath
• Xpath confuses everyone.
Including me.
• It’s basically a way to point to
a specific HTML element, or a
bunch of elements.
• We’ll look at a super simple way
to use it. Maybe you’ll want to
go learn more about it.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
ImportXML
• importXML lets you specify a
URL and Xpath to perform on the
returned source:
Column C:
=ImportXML(A2, "//title")
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
ImportXML
• Column C was easy. Column B is
a bit more challenging:
=substitute(ImportXML(A2,
"//meta[@name='description']/@content"),char(10),"")
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Xpath is a Roadmap
Painting a path to a specific
element in code:
"//meta[@name='description']/@content”
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
It’s in the meta Its name is ‘description’ Give me the content
The “OH SH*T” Moment
The moment when
you’ll realize how
freaking powerful
ImportXML with
Xpath is.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
BRB, Parsing Google
You can use ImportXML and Xpath to parse Google SERPs.
It even uses a Google internal IP address instead of
yours, so your office won’t get stuck in CAPTCHA hell.
Cheat Sheet: ranktank.org/damntools/ @seanmalseed
Yes. Oh sh*t indeed.
=importxml("https://www.google.com/search?num=100&q=query","//h3[@class='r']/a/@href")
Xpath to grab just the search result URLs
And on that bombshell…
RankTank.org
CircleRank.com
I do “the Twitter”
@seanmalseed
Cheat Sheet: ranktank.org/damntools/ @seanmalseed