What Is An Anchor Tag and What Is An Anchor Tag ID?

 

Ahoy mateys! The next two blogs are all about anchors. At the end of these two blogs, you’ll know the what is an anchor tag, anchor text, and most importantly, anchor tag IDs. You’ll also know whether or not you need anchor tag IDs for better tracking on your website.

What is an anchor tag? 

Any time you have a clickable element in your website, you will also have multiple attributes associated with that element. When you group all those attributes together in coding, it’s called a tag. When we talk about an anchor tag, we’re describing the clickable element (i.e. a link) you have on your website and all the attributes associated with that clickable element.  

You’ll notice I said clickable element – not url. That’s because everything that’s clickable doesn’t have to necessarily be a url. You can have clickable images, hashes (#) that just bring you down farther on a page, and more. When we talk about attributes associated with that clickable element we can be talking about the different text on a link (anchor text), an ID associated with that particular link (anchor tag ID), and what that link goes to (href). 

what is an anchor tag

What are anchor tag IDs: A deeper dive 

As you begin to delve into Google Tag Manager (or any sort of basic web development for that matter), the subject of ids for anchor tags may come up. It’s even more likely to enter the conversion when you’re talking about click tracking (tracking clicks throughout your website).   

Anchor tag IDs are used to specify an element’s (a link’s) unique identifier. The key word here is unique – while you can have the same id throughout the site, you can’t have two of the same id on the same page.  

You’ll likely see anchor tag ids shortened as an “a id” – but don’t call them that. 98 out of 100 web developers won’t know what you’re talking about (and it makes you look a lot less knowledgeable). The best way to describe the “a id” is as an anchor tag id or an id for the anchor tag. These terms can be used interchangeably.  

IDs for anchor tags are completely optional, although depending on the documentation you see, it may seem as though it’s a standard in web design or you absolutely can’t do click tracking without it. Spoiler – they’re not a standard and you absolutely can do click tracking without it. 

Summary 

Anchor tags are what makes it possible for you to click on a website element and have it go somewhere. Sometimes you’ll see developers add an ID on them, but not always, as IDs are a completely optional part of web development. 

Stay tuned for whether or not you need anchor tag IDs for tracking in my next blog!

 

Stay in the know with email updates!

* indicates required