Analytics
2.7K members online now
2.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Capture source URL when utm_source is set

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all, I'm fairly new to Google Analytics. I just started learning about the utm variables and how that can really help understand what GA is showing me.

 

My question is this, if utm_source is NOT explicitly set GA will capture the referring URL as the source.  Is there a way to capture the URL in a different utm variable?  

 

For example, my old implementation would show the following:

Source: referringURL.com

Medium: referral

 

Now I set the parameters like so: utm_source=8&utm_medium=1234 so it shows this:

Source: 8

Medum: 1234

 

I'm looking for a way to still capture the referring URL so that maybe utm_campaign=referringURL.com

 

My biggest problem is that I don't have control over the referringURL so I'd like the system to do it in such a way that I don't have to hardcode a URL.

 

Any help would be greatly appreciated.

2 Expert replyverified_user

Re: Capture source URL when utm_source is set

Top Contributor
# 2
Top Contributor
Hi Bobbie
Unfortunately as far as I'm aware, you cannot change the default behaviour of the auto population of utm variables. The only way I can imagine this is if you host the analytics.js file locally and make the modifications yourself. I wouldn't recommend this though.

Im at a loss as to why you'd want to do this though. Why not just let it be auto set in the correct parameter?

Re: Capture source URL when utm_source is set

Top Contributor
# 3
Top Contributor
Hi,

it is somewhat challenging to come up a solution when I'm trying to guess what are you trying to use this for... So if you can give any backgrounds I think that would speed things up.

You can set your URL to any UTM parameter. Maybe you could print the URL with JavaScript to your link?

Another possibility is to manipulate incoming traffic with filters but that leads to the dark side pretty quick.
--
To make bad day worse, spend it wishing for the impossible

Antti Nylund, Google Analytics Top Contributor
Did my answer solve your issue? If yes, please mark it as the ‘Best Answer.’ Otherwise keep on asking.

Re: Capture source URL when utm_source is set

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
I want to try and capture where my traffic is coming from. I don't mind leaving it in the source but I want to set some other variables. Unfortunately if you don't set utm_source as a variable you can't set the others. So I couldn't do something like &utm_medium=1234&utm_campaign=xx because the utm_source is required to be set.

Re: Capture source URL when utm_source is set

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
I have affiliates that run traffic to my page. I don't own their code, nor do I want to. I'm just looking for the link they send traffic from if GA can capture it.

Example: Affiliate A sends traffic from urlA.com. Affiliate B sends traffic from urlB.com As it stands without adding any UTM variables to their tracking links the source is their URLs.

I'm trying to add UTM variables to the tracking links so I can combine the data into something useable, but I cannot just set utm_medium without overriding utm_source.
Ideally I would be able to capture data like this:
the source of the data would be affiliate A, set with utm_source then the URL they send data from would be captured in utm_medium.

I want to have access to the actual referring URL because it helps with tracking down fraud transactions when I can see where the referring link is coming from.

GA does this natively if I don't set the utm variables. I'm trying to figure out if I can still capture that data just a little differently than the default behavior so I can also pull metrics based on other utm variables.

Does that answer your question?

Re: Capture source URL when utm_source is set

Top Contributor
# 6
Top Contributor
This is the bit I don't get, why not just leave the utm_source as it is and set the others? It would be really helpful (to us AND you) if you could produce a detailed use case with examples in as much detail as possible. While it might make sense to you, right now, to us, it doesn't. We don't have all the info that you have. You might have a perfectly reasonable reason and requirement but there's not a lot we can advise you in terms of alternatives without knowing more.

Re: Capture source URL when utm_source is set

[ Edited ]
Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

I tried to set only the utm_medium variable and it was ignored.

setting: example.com/?&utm_source=1&utm_medium=1234 captures the source and medium as one would expect, but does not pass the default source data.
setting: example.com/?&utm_medium=1234 sends the default source data (the referrer URL) but doesn't set the medium. it passes it as 'referrer' (which is the default behavior for this variable) and not 1234.

Re: Capture source URL when utm_source is set

Top Contributor
# 8
Top Contributor
Hi Bobbie,
Sorry, I didn't see your affiliate post.

Why don't you just use custom segments on the default non tagged URLs? You can then use custom variables to group traffic from your affiliates in any of these "little different" ways that you're alluding to. I think you're trying to fit a square peg into a round hole by doing it with URL parameters. There's better tools for this depending on what exactly you're trying to do. I'd investigate custom dimensions for this as I have a feeling it's what you're looking for.

Alternatively, just play around with custom segments to get the slice of traffic that you're looking for.

Re: Capture source URL when utm_source is set

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
Hello bobby!

you have to use like that:
example.com/?utm_source=1&utm_medium=1234 <-- The first utm use the '?', and the others use the '&'