top of page

Posted: July 16, 2021

Updated: Feb. 18, 2024


While you technically can hard code analytics and conversion tracking tags on your site, it's generally better to use Google Tag Manager (GTM) or an alternative such as Tealium or Mixpanel. There is no direct SEO advantage of using GTM, but depending on the number of tags you have, GTM may provide an indirect boost by improving page speed.


Install Google Tag Manager

These days, most websites and apps include multiple marketing and analytics codes such as Google Analytics, Google Ads, Mixpanel, and Facebook Pixel, to name a few. GTM works well even with non-Google products. Now, you can clean up all of those separate third-party tracking codes, and just copy and paste one instead - the GTM container code.


Google previously recommended placing the container code immediately before the opening body tag, but now is a little different. GTM has split the container, so the first part should be placed in the head, and the second part in the body.


GTM provides you with the exact code to copy and paste to your website. You can find the installation code along the top navigation under Admin → Container Settings → Install Google Tag Manager. For sites hosted on WordPress, use the Insert Headers and Footers plugin or insert the code directly from wp-admin/theme-editor.php, or Appearance > Theme File Editor.


The first part is a script tag, which includes a JavaScript function that loads your container to the page. It creates a new script tag, and sets the source to the URL to your container. This should be placed immediately inside of the head to optimize tracking. The higher up in the page the snippet is, the faster it is loaded.


The second part is a no script tag, and it's actually optional. This is just a backup tag that allows you to track users without JavaScript, so it's not important in most cases. It's telling the browser: if the user does not have JavaScript enabled, then render an iframe version of the container to the page.


DataLayer is used to feed data to GTM such as clicks, form submissions, purchases, user ID, login method, etc. The best practice is to add dataLayer above the container. Otherwise, it can cause issues such as the container code overwriting dataLayer.


Form Submission Tracking

Here are several methods for form submission tracking with GTM, in order of easiest to most complicated. Since the feasibility of these methods will depend on how your site is coded, I created this flowchart on Canva that shows the relevant tracking methods for each situation. Detailed explanation follows.



First, if your users are redirected to a confirmation page after the form submission, you can simply track page views for that page. Otherwise, you'll need to dig deeper in the page's source code to find some variable that GTM can recognize. At this point, if you are tracking Google Ads conversions, remember to add All Elements in addition to All Pages as a second trigger for your Conversion Linker tag.


Otherwise, if the form displays a unique confirmation message upon submission (ex. "Thank you for contacting us!"), you can use the Element Visibility trigger type in GTM.


Finally, if the element has an ID, it's easier to use Selection Method: ID. Otherwise, use CSS selector, which is explained later in this post. Also in the trigger configuration settings, regardless of which selection method you choose, check Observe DOM changes and change Minimum Percent Visible to 1 percent.


Button Click Tracking

If you form has neither a confirmation page or message, you'll need to track button clicks in GTM. This time, we'll be using the Click - All Elements trigger type. There are several possible variables that can be used for this method, but Click ID or Click Classes is probably the most common. Generally, Click ID might be more reliable, but it depends on your dev environment.


To see which variables are available for you, use preview & debug mode in GTM or check dataLayer in the Console. Note that Click Element cannot be used for this method, but it is explained in the following section on CSS selectors.


CSS Selectors

If none of the above methods so far have not worked, it's time to use CSS selector. You'll need to use CSS selector for some of the following situations.

  1. You are using the Element Visibility trigger and Selection Method: ID is not available.

  2. There are no unique variables available for tracking button clicks using Click - All Elements trigger type.

  3. The button is made up of multiple elements.

We've already seen situations 1 and 2, so I will just elaborate about 3, using the same example of the contact form on my website. Here is the source code for the "Send" button.

<div id="comp-k0kz041v" aria-disabled="false" class="_2UgQw">
	<button aria-disabled="false" data-testid="buttonElement" class="_1fbEI">
		<span class="_1Qjd7">SEND</span>
	</button>
</div>

The background and text elements are separated. However in GTM, we want to treat them the same, because we want to track form submissions regardless of whether the user clicked precisely on the "Send" text, or anywhere else within the button.


This is possible with CSS selectors, which allow you to write complex conditions for selecting certain elements on a website. To implement this method, start by creating a Click - All Elements trigger, but this time choose Click Element matches CSS selector for the variable. For this example, either of the following the CSS selectors should work.

 #comp-k0kz041v, #comp-k0kz041v *
 ._2UgQw, _2UgQw *

Deciphering the above CSS selectors:

  • # indicates id; . indicates class

  • Comma indicates OR condition

  • * is wildcard

The first CSS selector in plain English means, element with ID comp-k0kz041v or any child (or child of child, etc.) of that element. The second one means, element with class _2UgQw, or any child of that element. Note that spaces will break your CSS selector, so you can simply replace any spaces within the ID or class with a period.


This is a basic setup example, but here is an expanded list from W3schools of CSS selectors for reference: CSS Selector Reference


Trigger Groups

By default, if you add multiple triggers to a single tag on GTM, they are treated as an OR function. The tag will fire as soon as any of the triggers has its condition met. To treat multiple triggers as an AND function, use Trigger Groups, which were introduced on GTM recently in March 2019. Trigger Groups will be useful if you have multiple forms with the same confirmation message, or multiple buttons with the same class.


Debugging

There's several ways to check if your GTM tags are set up and firing correctly. First, check your website's source code and make sure that the GTM script is implemented by searching for gtm.js. If that wasn't the problem, you can check the other solutions below.


Preview & Debug Mode

As the name suggests, preview & debug (P&D) mode in GTM allows you to preview your site and check which tags are firing, and what data is sent to third-party platforms. Please note that P&D was updated in October 2020 to shift from 3rd party cookies to first party storage, so if you are following a guide or video that was published before that, it will look different.


As a freelancer or agency-side marketer, you might not have access to the client's GTM account. Even as an in-house specialist, there might be a different department that controls GTM. However, there are several methods to verify GTM even if you can't access the account.


Tag Assistant Legacy

Tag Assistant Legacy is a Google Chrome extension by Google for GTM, an extremely useful tool for testing and debugging. You can use it to troubleshoot GTM, as well as Google Ads, Analytics, and DoubleClick implementation.


Test Conversions

You can also simulate a test conversion - the way to do this depends on your specific conversion event. For example, if the conversion event that you want to test is pageviews on GA, just open the page in another tab and check GA. If you aren't sure because there are other pageviews, you can add a test utm such as:

/?utm_source=test&utm_medium=test&utm_campaign=test

In some PPC platforms like Facebook, you can just visit the confirmation page to manually simulate a conversion, and confirm it in the conversion events page. For Google Ads conversions, add the following parameter to the end of your URL to simulate a click.

?gclid=test&wc_clear=true

Custom Code

Setting up tracking between Google services like Analytics and Ads is pretty straightforward, and the built-in variables should be enough to get the job done. But if you're using GTM to connect your website to third-party platforms like Pardot or HubSpot, you'll need to add custom html or JavaScript via new user-defined variables. Note that custom JavaScript must be nested in an anonymous function with return value.

Posted: Oct 21, 2021

Updated: Feb 16, 2024


Site migrations are major changes that inherently pose a risk to SEO. Redirect issues may persist in Google Search Console post-migration. For global sites, worst case, Google can think that your site doesn't have the same local authority post-migration. It's normal to see a temporary 15-20% decline in organic traffic, as Google recrawls the new site. In most cases, this short-term dip resolves on its own. However, errors related to redirects, duplicate content, metadata, and other technical elements can prevent organic performance from returning to prior levels.


“Site migration” is a broad term — it could mean switching hosting providers, moving to a new CMS, or overhauling content for a rebrand. While I also help clients move to and from WordPress and other CMS platforms, this post is specifically about domain migration — what happens when you change your website’s address.The following guide serves as a basic checklist to help you execute a smooth site migration (domain migration) without losing your previously hard-earned SEO.


1. Page Indexing

Export the Search Console data from your legacy site: search analytics queries & pages, crawl errors, blocked resources, URL parameters, structured data, etc.


Then, set up a new property for your new domain. Ensure that it is set up for the proper version, accounting for http, https, and www. However, note that creating a property does not automatically make Googlebot aware of your site.


Screenshot of Google Search Console error: Processing data, please check again in a day or so

If the Indexing status remains stuck at "Processing data, please check again in a day or so" for many days, it's possible that Google hasn't found your site. You can try to resolve crawling issues by submitting a sitemap, adding links that point to your site, or submitting an indexing request for your homepage. If your pages are well linked among themselves, Google should be able to find all your pages from your home page.


Don't worry if your new domain doesn't get indexed right away. It can take weeks for new pages to be crawled, even when you submit a crawl request. This lag is even more common for migrations, in part because Google wants to be confident that the move is permanent, not some sort of temporary mistake. If the old domain is still indexed, then Google will see your new domain as duplicate content (i.e. not worth indexing). In most cases, this doesn't really matter because users can still find your site, they just need to go through the redirect. You don't need to do anything, just wait until 1) the old domain is recrawled and indexed as a nothing but a redirect, and 2) the new domain is crawled and eventually indexed in its own right.


On the other hand, you could be experiencing specific indexing issues that do require some action. If so, start by cross-checking the page indexing status on the URL Inspection Tool in GSC. If the status is different from what is on the page indexing report, treat the URL Inspection Tool as the source of truth.


This page outlines all of the possible indexing statuses and how to fix them. I will briefly mention two of the most common ones here below.


Discovered - currently not indexed

First, the "Discovered - currently not indexed" status means that Google knows about your page but hasn't crawled or indexed it yet. If you only have a few pages with this status, go ahead and request indexing via the URL inspection tool. There is a limit on how many URLs you can submit. While this is not defined in the docs, you can typically submit 10–15 URLs daily.


Crawled - currently not indexed

"Crawled - currently not indexed" is another GSC status, which means that Googlebot visited your page but didn't index it. Consequently, the page won't appear in Google Search. This could be due to low-quality or duplicate content, or poor website architecture. If the page(s) with "Crawled - currently not indexed" status are things like category pages or archive pages with thin content, then it's understandable that Google deemed those as not providing any value to the users to be indexed. If that's the case, you may ignore the "Crawled - currently not indexed" status.


Another question that often comes up here is, should you noindex category pages? However, there is no need to do so. In fact, noindexing too many category pages could even have a long-term negative effect. Google previously confirmed that if they see a persistent noindex, they will begin to treat the page a soft 404. As a side note, you may consider noindexing category pages if you see that they are causing direct conflicts with rankings, but that wouldn't be the case if the GSC status is "Crawled - currently not indexed."


Remember that Google can't index every page on the Internet. Its storage space is limited, so it needs to exclude low-quality content. In addition, Google's content evaluation is ongoing, so your SEO practices should be as well. Even if your page is indexed today, don't assume that it will always stay that way. So focus on making sure that your important pages are receiving internal links, and that you don't have orphan pages.


2. XML Sitemap

Generate a new XML sitemap with the new pages, site structure, and hreflang if needed. After the site migration, upload the new XML sitemap to Google Search Console. You can submit both the old and new sitemaps to clarify that a migration has taken place.


3. Canonical Tags

During a migration, you may temporarily have duplicate content, making it difficult for Google to decide which page to show in the SERPs. To make sure that Google shows the page that you intend, use canonical tags to signal which is the main version. Google will usually honor your signal and prioritize the canonical URL.


4. robots.txt

The robots.txt file tells crawlers which pages to access. If it is not properly configured, your new pages could be hidden from Google. After the migration, double check robots.txt to make sure that it includes the proper instructions for showing important pages and hiding old or irrelevant pages.


5. 301 Mapping

Typically, 301 permanent redirects are used to tell Google to transfer ranking signals and index the new pages. On the other hand, you can use 302 temporary redirects for pages that you are planning to sunset after the migration. However, if the original page has no backlinks or traffic, simply remove or replace any internal links pointing to them and then return a 404. Here's a flowchart by ahrefs explaining the process.

A flowchart explaining how to fix unnecessary redirects

6. URL Status Codes

After the migration, crawl the new site to verify that there are no error status codes. 404 and 501 errors are the biggest SEO offenders that you should prioritize resolving. The second biggest offenders are links to 301 pages on the old domain. Update your links to point directly to the new domain, not through a redirect.


It's also good practice to create a custom 404 page to help users navigate your new site, in case they land on a page that no longer exists.


Use this Google Apps Script to bulk check status codes.

// Get http server response status code
function getStatusCode(url){
  var options = {
     'muteHttpExceptions': true,
     'followRedirects': false
   };
  var statusCode ;
  try {
  statusCode = UrlFetchApp .fetch(url) .getResponseCode() .toString() ;
  }
  
  catch( error ) {
  statusCode = error .toString() .match( / returned code (\d\d\d)\./ )[1] ;
  }

  finally {
  return statusCode ;
  }
}

// Exceed importxml limit
function importRegex(url, regexInput) { 
  var output = ''; 
  var fetchedUrl = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); 
  if (fetchedUrl) { 
    var html = fetchedUrl.getContentText(); 
    if (html.length && regexInput.length) { 
      output = html.match(new RegExp(regexInput, 'i'))[1]; 
    } 
  } 
  Utilities.sleep(1000); 
  return unescapeHTML(output); 
} 

7. Keep the Old Domain

Unless the purpose of the migration was to sell the old domain, I recommend keeping it even after Google stops indexing it. When preparing the site migration, you should have redirected old pages to new pages on a per-page basis. But if those redirects are lost, the backlinks earned on the old domain will also be lost.


---


Successfully executing a site migration requires precision, patience, and a strong understanding of how Google reacts to change. If the checklist above is too overwhelming, or if you simply don’t have the time to manage every technical detail, you don’t have to go it alone. As a dedicated technical SEO specialist, I partner with businesses to execute site migrations while preserving their organic traffic and search rankings. My services include consulting, planning and implementation (ex. building a comprehensive redirect map), and overseeing all technical aspects to ensure that nothing is overlooked. Contact me today to discuss your site migration project.

Getting the first 1,000 subscribers is often considered the hardest part of growing a YouTube channel, but it's definitely possible. YouTube is the second most-visited site on the web, and we now spend up to 6 hours per day consuming video content. Considering that YouTube also has over 2 billion active users, there's still room for new channels to grow.


So, how long does it take to get 1000 subscribers on YouTube? Well, the average YouTube channel grows quite slow initially. Most channels take an entire year before they reach the 1000 subscriber milestone. See if you can accelerate the growth of your channel with the following tips.


YouTube SEO

The basics of YouTube SEO are no different from web SEO.

  1. Optimize the video titles and descriptions for your target keywords. A lot of the repeated advice is to keep titles under 70 characters in length. This is because that's the maximum that is displayed without the text being truncated.

  2. Regularly check YouTube analytics. In addition to researching target keywords, check the search queries for your existing videos, in the Analytics tab in YouTube Studio This can give you inspiration for new target keywords that you hadn't thought about.

  3. Include your target keyword in the video file name before uploading it. Don’t use spaces between each word, but rather hyphens or underscores. 

  4. Add relevant tags to each video. While most users don’t use tags to find videos, they can help the YouTube algorithm categorize your video and serve it to the appropriate audience. Keep it under 5-8 industry tags to avoid being flagged as spam. There are actually two places to add tags. The first is under Video details > Advanced Settings > Tags. The second is by simply including hashtags in the video description.

  5. Add your video category to each video. While not as specific as tags, categories also help the YouTube algorithm understand what your video is about, and help users find your video.

  6. After you've built up your video catalog for awhile, organize your content into playlists. This is  great for SEO and viewer engagement, leading users deeper and deeper into your content and increasing the chance they subscribe.


Promotion

Don't even think about promotion until you have uploaded at least 10 videos. If you only have a few videos, the YouTube algorithm is still learning your channel and audience. So the more data you give YouTube, the more likely that the algorithm puts your videos in front of relevant viewers' eyes. 


Once you're ready, start by cross-promoting on your personal website, Twitter, Instagram, Reddit, or Facebook groups. On the YouTube side, you'll need to first complete a one-time verification before you can include clickable links in the video description.


Video Quality

The aforementioned tips only matter if you're committed to producing high-quality videos. Watch through the finished product with a critical mindset. 


You don't need to be a professional filmmaker or editor, but keep some basic guidelines in mind when recording.

  • If possible, outdoor light is usually better than indoors. If it's late at night, find somewhere with the most light to record.

  • Beware of background elements that just add visual clutter.

  • If you're filming people (either yourself or others), don't cut off heads at the neck or feet at the ankles. Either move in closer or back wider.


For your first 20-30 videos, aim to try something new each time. Experiment with the background music, camera angle, theme, length, etc. of your videos and see what works. You'll know that you've got it right when you start getting an influx of views via browse instead of search.


Note that videos as short as 1 minute can be monetized, but the optimal length to ensure a high ROI is around at least 8 minutes.



Monetization

YouTube needs a critical mass of videos and subscribers before they can make an informed judgment of whether your channel meets the monetization policies. But once your channel hits 1,000 subscribers, it's eligible for the YouTube Partner Program. This means that you can monetize your video and earn income from ads. The other requirement is getting 4,000 hours of watch time in the past 365 days or 10 million public Shorts views in the past 90 days.


Before getting started with your ads account, read through the YouTube Community Guidelines and monetization policies.


Curious about your favourite channels? This site estimates how much revenue a monetized video has made: https://isthischannelmonetized.com/


bottom of page