Tracking where visitors are coming from is very valuable.

When you know where the traffic is coming from you can decide if you should invest more in that particular channel.

I am assuming that you’ve read this great article about UTM parameters:

We are going to shorten the URLs with lots of utm parameters a bit. The solution will require a web hosting with Apache web server. The .htaccess rules should be easily adapted for nginx web server and they have to be appended to the site’s virtual host file.

I prefer not to use external shortening services regardless of the analytics they provide because those services can go away or change their terms of service at any moment.

Here are the rules that have to be added either to the sites’s Apache vhost or in your .htaccess file.

<IfModule mod_rewrite.c>
	RewriteEngine On

	# Enables me to have a short link that expands so we can tell where people are coming from
	# e.g.
	# e.g.
	RewriteRule ^/?(?:yt?|youtube)\-?([\w\-]*)$/? /?utm_source=youtube&utm_medium=social&utm_content=$1&utm_campaign=video_mkt [L,R=302,QSA]

	# e.g.
	RewriteRule ^/?e?mail\-?([\w\-]*)$/? /?utm_source=email&utm_medium=newsletter&utm_content=$1&utm_campaign=email_mkt [L,R=302,QSA]

	# -> blog post
	RewriteRule ^/?b?\-?([\d]+)$/? /?p=$1&utm_source=blog&utm_medium=blog_post&utm_content=$1&utm_campaign=content_mkt [L,R=302,QSA]

As a result you can link to your site as follows. By the way I like to put a link in multiple places. In the video even though it’s not clickable. People can still type it and also start the video’s description. That way people can see the link right away. If the link is too long YouTube may break it or not show it in full.

That’s why it’s super convenient to have something like this:


if you’re linking to your site from a specific youtube video (recommended).


If you’re using the 2nd approach you’ll start seeing the stats in your analytics.

Then you can easily see which video is referring you the most traffic.


The full link will become:


Just append the video ID to this link to view it.


If you’re sharing a blog post you can use where 123 is the post ID.


You can see the post ID when you go to edit a post it should be shown in the URL.


If something needs correcting in this article, you have an idea or suggestion always let us know