I planned on posting a brief intro to the HTML and CSS that a beginner should know to work on an ebook, but I’m in the middle of launching my YA historical novel Risuko this month, and so I need to share a shorter, more technical post. This month, I’m going to teach you how to build links from your ebook that can be tracked in Google Analytics.
Well, although an ebook is nothing more than a website in a box, and it can link to sites on the open internet, it doesn’t connect to those sites the way that a regular site does. You can’t automatically tell where a hit to your blog came from — what book, what retailer, what chapter. On Google Analytics and other tools for tracking hits, it will show up as a hit from nowhere.
Fortunately, there are tags that you can add to your links that will make it easy to track where exactly those hits came from!
Meet the UTM codes
UTM (Urchin Tracking Module) codes are parameters that you can add to your links to let Google Analytics know where a hit originated, even if it was an off-line source. They were created for advertisers, so that they could use redirection and short links (like bit.ly, goo.gl, etc.) to find out when a hit came from a particular ad in a particular newspaper, or a particular commercial on a particular radio station.
But we can use the same codes to help us with our ebook links!
There are a bunch of UTM codes, but these are the three we care about:
- UTM_source: This tracks where the hit came from — a particular paper, station, etc.
- UTM_campaign: This (logically) tracks which campaign from — a particular ad, commercial, or whatever
- UTM_medium: This tracks whether the reference came from a direct referral (a click on a link), a paid ad, or something else
Linking from your ebook
If you’ve read some of my other posts, you know that I’m a big advocate of including links in your ebook that will bring readers to your website, or allow them to post on social media about what they’ve just read, or review your book, or buy the next one. In order to do that, you need to create hyperlinks.
Fortunately, whatever app you are using to build your ebook — whether it’s a word processor like Word, a page-layout package like InDesign, or a dedicated ebook editor like Sigil — there will be a way to add hyperlinks. Usually, it can be accessed by hitting command-k on a Mac or control-k on a Windows computer.
Once you’ve opened up the hyperlink dialogue, you’ll be asked to add a destination URL. Here’s where the magic starts.
First, choose the page or site you want to link to. That should be easy! Then copy the address. Don’t forget to include the protocol (i.e., HTTP:// or HTTPS:// or MAILTO: or whatever) — otherwise, it will look like a “local” address. When people click on the link, the ereader will look inside your “website in a box,” but not finding the address, it won’t go anywhere.
Then paste the URL into the dialogue.
So let’s say you’re linking to the landing page for your next book on your author site. The URL might look like this:
Adding the tags
Now comes the real magic. We’re going to add those UTM codes onto the link.
- We’re going to use utm_source to mark the title of the book (or a code that will let us know the title).
- We’re going to use utm_campaign to tell us which retailer the reader bought the ebook from.
- And we’re going to bend the meaning of “medium” a bit and use utm_medium to tell us where in the ebook the reader clicked.
Letting a web browser know that the codes are parameters — non-essential add-ons, rather than part of the actual address requires that you use special separators. Before the first parameter, you have to have a question mark (?).
Before each subsequent parameter, you need to add an ampersand (&). So let’s say we’re creating a hyperlink from the “Other Books By” section of your ebook. For the version of ebook that’s going to be sold on Amazon, the complete link would look like this:
Notice that each UTM code is followed by an equal sign (=) that links it to the value we want Google to pick up. Notice too that you should NEVER put spaces in the middle of a URL! Replace them with hyphens or underscores.
Here are some examples from ebooks I’ve published — you should be able to tell which book it came from, what section the link was located in, and what retailer the reader bought it at:
The values you add aren’t important—but you should keep them consistent, or the results won’t mean anything on Google Analytics. If you always give links on copyright page the value utm_medium=COPY, then you’ll be able to see how many hits come in from that page. (Hint: it will be a lot, since a lot of folks will click from the “Read Inside” feature on Amazon.)
Reading the Results
Now that you’ve added the coded links and uploaded your ebook to the various retailers, it’s time to sit back and check the results on Google Analytics! In order to track the hits, you’re going to want to go to one of the reports in GA’s Behavior section. I usually go to:
This will list all of the hits to your site by the campaign that sent the visitor — including any AdWords or Facebook ad campaigns, for example, but also the values we added to our utm_campaign tags — the retailers!
Now, right below the lovely graph at the top of the report is a menu bar. There’s a popup that reads Secondary Dimension. When you click on it, a search box will pop up: enter Medium and select Source/Medium. The chart that comes up will break down our hits by the utm_source and utm_medium tags we’ve added.
Now you can tell which book has been driving the most traffic to your site, which pages provide the most traffic, and where the visitors bought your book!