Referring URL?

Is there any possibility to find out which is the URL from where a customer subscribe to my website newsletter?(the subscriber referring url).

I think that it is a small code that should be inserted in the subscribe form.

Thank you.

Stig Stig, 8 years ago

Hi marius_2,
there are a number of ways this could be done. The best method would involve a server side script. If this is an option for you, you could ask the developer who works on your site, or post some technical details here to see if anyone can help.

If this is not the case, here's a javascript solution that any Campaign Monitor user can use:

Add a custom field to your list, and call it something like "Referrer".

Go to the "Create a Subscribe Form" page, and check the box next to your custom field (under "1. Fields to include in the subscribe form").
Click the "Save and Regenerate HTML code" button.

Paste the HTML that Campagin Monitor returns where you want the form on your page. Now you have a basic signup form with your custom field.

Then add some javascript to the head section of your HTML:

<script type="text/javascript">
   var oldOnLoad = window.onload;
   window.onload = function() {
      if (oldOnLoad)
      document.getElementById("Referrer").value = document.referrer;

This populates your custom field with the referrer URL (if there is one).

Lastly, change type="text" to type="hidden" in your referrer input field, and remove Referrer:<br />.
This hides the referrer field, and removes it's label.

This works as long as the user doesn't have javascript disabled.
I tested it successfully on a number of browsers in Windows XP:
The latest versions of Firefox, Opera and Safari, as well as every version of Internet Explorer all the way back to 5.0 (4.0 returned an error).

As I mentioned in the beginning, there are better ways to go about this, including methods to get the original referrer, if the user clicked around on your site before signing up.


The Campaign Monitor Blog – HTML email smarts to go with your good looks.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free