I have a marketing site (site A), and an application site (site B). The sole purpose of site A is to encourage users to register on site B, via various marketing content.

The sites run different Analytics properties, because I want to see stats about app users (number of sessions, browser type, etc) separately from stats about the marketing site. (NB: Maybe there's an easier way to handle this?)

I have goals set up for registrations and payments on site B. My task is this: I want to track where the users who complete the registration and payment goals on site B originally came from - i.e. before they arrived at either site A or site B. This is so that I can check which ads and other sources are most likely to generate paying customers.

The users' paths to the registration goal could be follows:

  1. Twitter ad -> Landing page on site B -> Register on site B
  2. Third-party blog -> Site A -> Follow link to site B -> Register on site B
  3. Google search -> Site A -> Follow link to site B -> Register on site B

I would like to record their origin points as follows:

  1. "twitter ad X"
  2. "blog post X"
  3. "google search keyword X"

I'd like to record this in my database on registration and I'd also like to send the info to Analytics.

My Twitter ads are set up to use utm_source and utm_campaign on inbound links.

So what's the best way to record where users came from, in order to say "X% of paying customers came from Twitter ads, X% from blog post X, X% from blog post Y, X% from organic search"?

One idea: I could keep the referrer in a cookie, and pass it as a custom dimension to Analytics and also into the database when the user registers? This would also handle the problem of users navigating away from the site and then registering at a later date.

I know Analytics provides utm_source parameters, but how can I ensure that these are tracked between site A and site B? The user may click several pages on site A before going to site B.

  • 1
    I think you want cross-domain linking: support.google.com/analytics/answer/1034342?hl=en I haven't used it myself, so I'm not sure if will allow UTM params to flow across sites. Commented Feb 15, 2018 at 19:37
  • Thanks! The problem is that I have already set up two different properties, and cross-domain linking seems to require that you use the same property. Maybe I just need to delete one property?
    – Richard
    Commented Mar 13, 2018 at 17:34

1 Answer 1


You can use http_referrer in PHP as long as the referring site is using HTTP:// and not HTTPS://

Some major companies on Twitter use url shorteners. This is primarily done to track how much traffic is coming from twitter. Say for instance you have Twitter link to http://example.com/JKFK and then http://example.com/JKFK redirects to http://yoursite.com/page . Your Google analytics should show the traffic coming from example.com

If a referring website is using HTTPS, it is very hard to track the referring page as HTTPSecure prevents a lot of data from transferring between the pages.

You can see which google keywords are driving traffic to your page in the Google webmaster search console.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.