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 ?

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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>

3 Comments

hi - i dont have control over domain2.com but i have control over external.js.
@Balaji: Then there really is no way to get that first referrer, unless, domain2.com passes it on to you directly.
@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.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.