5

Let us take i am in site named domain1.com and navigating to another site domain2.com, where i invoke a external js call.

The problem is the referrer of the js call is domain2.com and but i need the original referrer i.e. domain1.com. I see that the google analytics request, i see that the query parameter utmr hold the referrer url. example - utmr

Any idea how to get the same as that in GA ?

Community
  • 1
  • 1
Balaji
  • 859
  • 1
  • 16
  • 27

2 Answers2

3

I got the solution, it is simple. The document.referrer added in external script works fine and provide the referrer URL of the current page.

Thank you Balaji

Balaji
  • 859
  • 1
  • 16
  • 27
0

Some questions:

  1. Do you have control over domain2.com?
  2. Do you have control over the external js that you are calling?
  3. If not, is there a way to pass a different referer via a parameter?

You cannot change the referer page on a service call you are making to another service. However, the source code on domain2.com containing the external js call will have access to its own referer on domain1.com, and will need to pass it as a parameter, providing the remote JS interface allows passing a referer parameter. This is accessible through the server code language you are using. For example, here it is in PHP:

<script type="text/javascript">
    var referer = "<?php echo $HTTP_REFERER; ?>";
    doRemoteCall("theRemotePage?referer=" + referer);
</script>
mellamokb
  • 56,094
  • 12
  • 110
  • 136
  • hi - i dont have control over domain2.com but i have control over external.js. – Balaji May 06 '11 at 19:19
  • @Balaji: Then there really is no way to get that first referrer, unless, domain2.com passes it on to you directly. – mellamokb May 06 '11 at 19:20
  • @Meallamokb - i see that the google analytics is able to fetch the original referrer. you can in the GA call where utmr query parameter contains the original referrer. – Balaji May 06 '11 at 19:25