Let’s say you own two sites.
One is your blog (https://blog.placeit.net) and the other is an ecommerce site (https://placeit.net).
You use two different Google Analytics codes for each property and want to track which links from your blog created conversions but you don’t want to create a unique utm value for each link to indicate the source page.
We had the same issue here at Placeit so we made a little script for you to accomplish just that.
After pasting the script, you will see the URL of the source page as the utm-term automatically appended to all of the pages from the URL you specify.
In our case, the UTM source we use is “placeitblog” and if a blog post’s URL is “https://blog.placeit.net/
- If no campaign source is given, the code will only append the UTM term.
- Otherwise, it will remove any existing UTM Source tag and replace it with whatever source was typed into the text box.
- By typing a URL on the domain field you choose to append the UTM Campaign Source and Term only to links belonging to a specific domain, e.g https://yoursite.com
- Leave the domain field blank will append the UTM code to all links on your site. This will include external links.
Just place the script in every page. If you’re using WordPress, you can put it in your header or footer.
And that’s it. Since using this method has made it super easy for us to track the performance of our blog posts as unique entities and not just as a whole, we thought it might also be useful for you to make your own script and add to your website or blog.
Feel free to use the UTM code generator and share it with peers and colleagues, we will be glad to know if you have any feedback for the team 🙂
Copy the code generated and paste wherever you keep your site scripts. e.g. for wordpress the header.php file.
Append anchor/alt text as campaign content: