Discussions

How to Capture Referring Sources to Landing Pages and in Forms using Query Strings

gaea.connary
gaea.connary Posts: 31 Bronze Trophy
edited Apr 29, 2022 6:21AM in Eloqua

A common reporting question from marketers is how to track visitors that come to their landing pages from a variety of sources such as email, websites, direct mail, social media, banner ads, etc. The key to achieving this is through creating explicit unique links to that landing page. In other words, if you use the same link for each source, there's often no way to distinguish from where visitors came. We need a way to make the URL unique, and this can be achieved through Query Strings.

Query Strings are an addition to your landing page URL, and they are quite easy to construct. Even better, you can capture out values from the Query String in your URL into your Forms, allowing you to write those values to the Contact record, and ultimately synch them to your CRM system. You've likely seen them before but may not have realized their value.

Here's a quick example to illustrate: today I visited aol.com and clicked on a banner ad for Zulily's Festive Frocks deal. This takes me to their landing page, and note the URL used:

https://www.zulily.com/auth/create/?tid=aoldisp_hmpg_festivefrocks

The part that is highlighted in green is the Query String. There are two elements to it: 1) the parameter (effectively the name of the Query String) which is "tid", and 2) the value (the unique value assigned). Zulily appears to have incorporated a lot of information into this value: "aol" is the referring website, "hmpg" might describe the banner size or placement, and "festivefrocks" is the content of the ad on which I clicked.

To further illustrate, I find another Zulily ad on aol.com, this time for Crocs. The URL of the landing page that this takes me to is:

https://www.zulily.com/auth/create/?tid=aoldisp_hmpg_300x250_1110_crocs_2

Note the parameter is the same, "tid", but the value is different: "aol" is captured again, but the information about the banner ad and the offer is changed. Zulily can use this information to see how I came to their landing pages in terms of the referring website, the banner ad, and the offer.

This is all extremely actionable information, and as a visitor, I haven't actually done anything yet – I'm still an unknown visitor. Zulily wants to me to be a known visitor by driving me to complete a form. My conversion tells Zulily that this was a good referring source and an appealing offer, and they can also pass this data into their system used to track me to eventually becoming a customer (i.e., CRM system). Thus the marketing operations team can close the loop on reporting right back to that original referring source. Yay for festive frocks!

So how do you execute this tracking in Eloqua?

1. Create your Query String:

1.    In Eloqua10, go to Setup>Query Strings

2.    In Eloqua9, go to Automate>Web Profiling>Query Strings

From here, the interface is the same: select from the "Query Strings" menu, "New Query String Parameter". Provide a Display Name (consider employing a standard naming convention if you will be using this method frequently) and Parameter (this needs to be unique to the Query String).

ReferringSourceQueryString-1.png

Although you have other options here, it's unlikely that you'll need to configure anything else on this page. Click the Save button when done.

In E9, you also have the option of also creating a Display Map, which allows you to map your values to more descriptive terms for readability in your reports. For E10 users, this capability is on the roadmap.

2. Create your Parameter values. Make a list of all of the elements you want to capture in your reporting, such as referring website, banner ad creative, offer type, etc. You can also use a Query String to capture a Campaign ID to use for reporting in your CRM system. Make a list of unique values for each that are short and have no spaces or special characters -- these are your Parameter values (note that these values should be captured locally; optionally, you can capture them in a Display Map).

3. Create your landing page URLs with the Query String detail. First, you'll need to get the base URL to your landing page. Let's assume your page is hosted in E10; the URL might look like http://asdftesting.eloqua.com/LP=1234. This part will be the same for all your referring sources (note the Zulily example above). Adding the Query String will make a unique link for each source.

Construct your URLs using the following format (no brackets):

{base url}?{Parameter name}={Value}

For example, say I have four referring sources, and my Query String Parameter name is "source". Using the base URL above, my landing pages URLs will look like this:

http://asdftesting.eloqua.com/LP=1234?source=email

http://asdftesting.eloqua.com/LP=1234?source=twitter

http://asdftesting.eloqua.com/LP=1234?source=qrcode

http://asdftesting.eloqua.com/LP=1234?source=bannerad

These are the links you'll use from each of your referring sources. For example, if you're hosting a banner ad on a third-party site, this is the link you'll need to provide to the ad manager for that site with your ad creative.

4. Create your landing page Form, including a hidden field for capturing the Query String. Make note of the HTML Name of that field, like so in E10:

ReferringSourceQueryString-2.png

And in E9:

ReferringSourceQueryString-3.png

You also need to make note of the HTML Name of the Form itself. In E10:

ReferringSourceQueryString-4.png

And in E9:

ReferringSourceQueryString-6.png

5. Add Javascript to your landing page to capture the Query String value from your URL into the hidden field in your Form. This Javascript is linked from the Eloqua Artisan blog post here: http://eloqua.blogspot.com/2009/04/lead-source-codes-capturing-with.html. Follow the instructions in the article to update the code with your HTML Form Name, hidden field HTML Name, and Query String Parameter.

In Eloqua10, you'll be placing the final Javascript into the Page Snippet Tools under "JS", like so:

ReferringSourceQueryString-7.png

In Eloqua9, the best place is in a Page Header Script, found here:

ReferringSourceQueryString-8.png

If your landing page is hosted outside of Eloqua, you may need to speak with your webmaster to add the Javascript.

6. Capture the Query String value to the submitter's Contact record. If you want to pass the value to your CRM system, you'll need to capture it to a field on the submitter's Contact record. You will need to complete the following steps:

1. Find or create an Eloqua Contact field for the data and a CRM Lead/Contact field.

2. Update your External Calls to map the Eloqua Contact field to the CRM Lead Contact field.

3. Add or update a Form Processing Step to write the value from the Form Submission to the Eloqua Contact field.

You may also want to add a Processing Step to your Form to add the Contacts to a Shared List, which may make it easier for segmentation and reporting for this audience going forward.

7. Test. Find a few friends or colleagues to help and give each a unique URL to your landing page. Ask them to click through and submit the Form, and then check that all of the data is captured appropriately.

A few caveats about this method:

  • It relies on Javascript; some visitors may have this disabled in their browser, and you will therefore not capture any source value for them.
  • The Query String Parameter value can only be captured if the Form is on that landing page for the URL. In other words, if the visitor clicks through on your URL containing the Query String, navigates around your site, and then comes to the landing page, the value is no longer in the URL and thus won't be captured.

Now that everything is in place to capture your referring source data, you'll of course want to report on it. If you chose to do your reporting in Eloqua, here's where you'll go:

MetricEloqua10 report
Eloqua9 report
Number of visitors to landing page by Query String value (referring source)Query String Parameter ValueQuery String Values
Number of landing page form submissions by Query String valueForm Submission Data (in the Settings menu for the Form itself)Form Field Values or Form Submission Data
Landing page conversion rate by Query String value# Form Submissions / # Visitors (you’ll have to do the math)As with Eloqua10

If you've captured the referring source to the Contact record, you now have the ability to do a lot of other interesting reporting, for example, looking a Job Titles by referring source, or even using that information in your Lead Scoring criteria. By passing the source to your CRM, you can also look at qualified leads, sales opportunities, and closed deals generated by referring source.

Query Strings are a powerful tool for capturing a variety of data out of URLs, including Google AdWords keywords, and you can also use the values to conditionalize a next step from your campaign landing page, such as Dynamic Content in a follow-up email. They can also be a great way to re-use one form for multiple campaigns – unique landing pages could popup the form or have it embedded in an iFrame so the visitor experience is seamless. Keep them in mind as you scale your campaigns!

Post edited by OIT Integration User on
Tagged:
«1345

Comments

  • Hi Gaea,

    This article is really very helpful!

    Thanks much!

    alvin :-)

  • Hi Gaea

    This is really interesting and clearly very powerful.


    I've tried to set this up and but am unable to get it going. Have been looking over where I may have gone wrong - but couldn't see anything obvious - have you got any tips on how I'd be able to test each bit individually to try and work out where the issue maybe?

    Thanks

    Marc

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Hi Gaea

    This is really interesting and clearly very powerful.


    I've tried to set this up and but am unable to get it going. Have been looking over where I may have gone wrong - but couldn't see anything obvious - have you got any tips on how I'd be able to test each bit individually to try and work out where the issue maybe?

    Thanks

    Marc

    Hi Marc,

    Excellent question! You should see the value for your Query String in your Form Submission report in that hidden field. If not, 1) check your URLs (if your URLs already have a Query String for another purpose, you may need to replace the ? with an & symbol, e.g. "http://asdftesting.eloqua.com/LP=1234?anotherQueryString=value&source=bannerad" (the order of the Query Strings is not particular, but just the first should have the ?, all others following the &), 2) check your Javascript -- note that you need to update 3 variables in it -- and make sure it's included correctly in your landing page. If you're still not finding the issue, contact Eloqua Support or send me a private message.

    Thanks,

    Gaea

  • Hi Gaea,

    Will this work if the landing page and the form is on an iFrame setup in our website?

    Thanks,

    Alvin

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Hi Gaea,

    Will this work if the landing page and the form is on an iFrame setup in our website?

    Thanks,

    Alvin

    Hi Alvin,

    I suspect it won't -- you'll need to pass the Query String from the landing page URL into the iFrame URL for it to work. This will take some additional Javascript, which I'm afraid I can't provide (I'm a copy-and-paste scripter only ), but perhaps another Topliner can assist.

    Thanks,

    Gaea

  • 2869156
    2869156 Posts: 1 Green Ribbon

    Great article. It beats cmpids from Omniture!

  • Eytan Abrahams
    Eytan Abrahams Posts: 35 Bronze Crown

    great article, thank you! Just started using this on a form and it's working great!

    Eytan

  • Finally a clear description of the process! I've been trying to figure out how to do this by reading the documentation but since I'm a marketing expert and not an it guy, I was totally lost. This is simple and quick

    One more Dummy clarification might be needed since I didn't figure this out at first:

    Everything after the ?{parameter}= is totally open and does not have to be entered into Eloqua settings. For example, if I create a sales person parameter (?sp=), sales persons may send a link to a client and write ?sp=ChuckRules and you can create a report from that.

  • Eytan Abrahams
    Eytan Abrahams Posts: 35 Bronze Crown

    Finally a clear description of the process! I've been trying to figure out how to do this by reading the documentation but since I'm a marketing expert and not an it guy, I was totally lost. This is simple and quick

    One more Dummy clarification might be needed since I didn't figure this out at first:

    Everything after the ?{parameter}= is totally open and does not have to be entered into Eloqua settings. For example, if I create a sales person parameter (?sp=), sales persons may send a link to a client and write ?sp=ChuckRules and you can create a report from that.

    Tero

    True about putting anything after the parameter, but much like setting up naming convention for your assets in Eloqua, you'd want to set up some sort of confvention and/or system for people using new codes, so that you can keep track of them easily, and make it easier to report on them.

    Eytan

  • I've got a question and a note for E10 users.

    Question:

    If i want to write a lead source to contact details using a hidden form, how do I add several parameters to the Java Script?

    I have three parameters gle for Google, fb for Facebook and bnr for banners. I've got the gle parameter to write but not the others.

    The original script line that tracks Google clicks looks like this:
    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle');

    I've tried:
    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle''fb');

    and


    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle')('fb');

    and

    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle');
    elqForm.elements['leadSource'].value = getQueryStringParamValue('fb');


    Advice for E10:

    Form properties shows the form HTML as non selectable (grey) after you've designated the address. The actual address is longer than the box. Find the full HTML addres from settings -> form HTML:

  • This is great! Works like a charm. We have been looking for this information for a long time. Thanks!

  • cjcorney
    cjcorney Posts: 7 Bronze Trophy

    I've got a question and a note for E10 users.

    Question:

    If i want to write a lead source to contact details using a hidden form, how do I add several parameters to the Java Script?

    I have three parameters gle for Google, fb for Facebook and bnr for banners. I've got the gle parameter to write but not the others.

    The original script line that tracks Google clicks looks like this:
    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle');

    I've tried:
    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle''fb');

    and


    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle')('fb');

    and

    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle');
    elqForm.elements['leadSource'].value = getQueryStringParamValue('fb');


    Advice for E10:

    Form properties shows the form HTML as non selectable (grey) after you've designated the address. The actual address is longer than the box. Find the full HTML addres from settings -> form HTML:

    Tero I'm assuming your url looks something like http://www.xyz.com?gle=1&fb=2&bnr=3

    You could use three hidden fields and the code below if you want to store this data in separate contact fields, at present you are only updating one contact field with one QS value.

    Note you will need to create two new hidden fields using this method as I have below:

    //repeat for each field to populate

    elqForm.elements['leadSource'].value = getQueryStringParamValue('gle'); // google

    elqForm.elements['leadSourcefb'].value = getQueryStringParamValue('fb'); //facebook

    elqForm.elements['leadSourcebnr'].value = getQueryStringParamValue('bnr'); // banner

    If you are looking to store all three values in one contact field then that is a different matter, but hope this helps with your problem.

  • 2869261
    2869261 Posts: 19 Silver Medal

    This is absolutely fantastic, Gaea!  It solved an immediate need for us.

    In case anyone else has this trouble, you don't want parenthesis ( ) in your HTML Form Name, hidden field HTML Name, or Query String Parameter.  It will cause the Javascript to fail. I was using the auto-generate feature for my HTML Form Name, which had parenthesis in it.  Luckily, I was able to figure this out with no trouble. I would guess this is probably true for any other special characters you see used in the Javascript.

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    I'm very glad to hear this has been such a useful how-to! And thank you to everyone who has added comments and recommendations!

    Gaea

  • Does anyone have any ideas on how this could be used with multiple email sources?  Here is what I mean . . . I have 3 different purchased lists (which we are importing) to which I want to send the same email. 

    I need to track the performance of each list, however, there is a possibility that same recipient could be on all three lists.  Is there a way to incorporate query strings so that I only need 1 landing page, 1 campaign, 1 form and 1 email and will be able to track which list performed the best?  My concern is that the same recipient that may show up on all three lists would receive the email 3 times if we create 3 different email files.

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Does anyone have any ideas on how this could be used with multiple email sources?  Here is what I mean . . . I have 3 different purchased lists (which we are importing) to which I want to send the same email. 

    I need to track the performance of each list, however, there is a possibility that same recipient could be on all three lists.  Is there a way to incorporate query strings so that I only need 1 landing page, 1 campaign, 1 form and 1 email and will be able to track which list performed the best?  My concern is that the same recipient that may show up on all three lists would receive the email 3 times if we create 3 different email files.

    Hi Felicja,

    Yes, you definitely want to avoid sending multiples of the same email to a Contact! Since the Query String is unique to the link, and therefore the Email containing that link, I think you'll need to capture the unique identifier for each list on the Contact record.

    Create a custom Contact field or use the "Lead Source (Original and/or Most Recent" fields, and include a unique value for each list into your upload file to map to that field. In your Form, add a hidden field and pre-populate it with that list value. You'll see which list each submitter came from in your Form Submission Report. You may need to do some concatenation outside of Eloqua to report on landing page visits by list. Let me know if you have any questions about the above!

    Regards,

    Gaea

  • Hi Felicja,

    Yes, you definitely want to avoid sending multiples of the same email to a Contact! Since the Query String is unique to the link, and therefore the Email containing that link, I think you'll need to capture the unique identifier for each list on the Contact record.

    Create a custom Contact field or use the "Lead Source (Original and/or Most Recent" fields, and include a unique value for each list into your upload file to map to that field. In your Form, add a hidden field and pre-populate it with that list value. You'll see which list each submitter came from in your Form Submission Report. You may need to do some concatenation outside of Eloqua to report on landing page visits by list. Let me know if you have any questions about the above!

    Regards,

    Gaea

    Thanks Gaea!  We are going to try this - if I understand you correctly, we don't need a query string at all, just the custom field or lead source field with unique value in the Contact record.  Then we will use one form with the hidden, pre-populated field.  Right?

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Thanks Gaea!  We are going to try this - if I understand you correctly, we don't need a query string at all, just the custom field or lead source field with unique value in the Contact record.  Then we will use one form with the hidden, pre-populated field.  Right?

    Hi Felicja,

    Correct, no Query String in this case, as it's just the one referring source (your email).

    Best,

    Gaea

  • Hi all - I have a question related to this:

    What if I don't want to put the entire value in the URL parameter? Is there a way in E10 that I can translate an abbreviated value in the URL parameter to the full descriptive value in the Eloqua field?

    For example: http://asdftesting.eloqua.com/LP=1234?source=em

    -When the source hidden field is captured from the above URL, it enters the source value as "Email" rather than just "em"?

    I have other uses for the query string parameter that require longer descriptions and I want to avoid having long descriptions in the URL.

    Thanks in advance for any help or ideas!

  • cjcorney
    cjcorney Posts: 7 Bronze Trophy

    Hi all - I have a question related to this:

    What if I don't want to put the entire value in the URL parameter? Is there a way in E10 that I can translate an abbreviated value in the URL parameter to the full descriptive value in the Eloqua field?

    For example: http://asdftesting.eloqua.com/LP=1234?source=em

    -When the source hidden field is captured from the above URL, it enters the source value as "Email" rather than just "em"?

    I have other uses for the query string parameter that require longer descriptions and I want to avoid having long descriptions in the URL.

    Thanks in advance for any help or ideas!

    Hi Gary,

    Yes this is possible, you could do this on the client / server-side using JavaScript or PHP before your form is submitted to Eloqua or you can handle this using an update rule in your processing steps or program if need be.

    Cheers,

    Chris

  • Hi Gary,

    Yes this is possible, you could do this on the client / server-side using JavaScript or PHP before your form is submitted to Eloqua or you can handle this using an update rule in your processing steps or program if need be.

    Cheers,

    Chris

    Thank you, Chris. I found the update rule in the processing steps of the form that did the trick. I'm not sure if there is any advantage/disadvantage to doing it this way vs. JavaScript, but it works and is easier to implement since I don't know how to write JavaScript (just a cut/paste, tinker with existing code kind of ability).

    Thanks for your help!

  • A lot of responses...I can only sat that this is a great article

    Great Job

  • This is one of the best articles I've seen on here.  Great job!

  • robinwu
    robinwu Posts: 8 Blue Ribbon

    Hi Gaea, just to clarify - this is only useful for when you have a list of known referring sources, correct?

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Hi Gaea, just to clarify - this is only useful for when you have a list of known referring sources, correct?

    Hi Robin,

    Yes, that's correct. You have to be able to manage the links from those sources to your landing page to use Query Strings.

    Thanks,

    Gaea

  • This is awesome!

    Would this also work within an email? I have a newsletter that has multiple links to the same landing page (no form). I want to be able to see whether someone clicked on the image that links to the landing page or the text link - would I be able to get that information using this same principle? (adding query parameters to the end of the landing page urlL ?source=image  ?source=text, etc)

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    This is awesome!

    Would this also work within an email? I have a newsletter that has multiple links to the same landing page (no form). I want to be able to see whether someone clicked on the image that links to the landing page or the text link - would I be able to get that information using this same principle? (adding query parameters to the end of the landing page urlL ?source=image  ?source=text, etc)

    Hi Kristin,

    Yes, absolutely! That's a great use case for Query Strings! You will have to edit the links in the HTML source view in your email to add the Query String detail, but that would be super-insightful testing data to have.

    Thanks,

    Gaea

  • Eytan Abrahams
    Eytan Abrahams Posts: 35 Bronze Crown

    This is awesome!

    Would this also work within an email? I have a newsletter that has multiple links to the same landing page (no form). I want to be able to see whether someone clicked on the image that links to the landing page or the text link - would I be able to get that information using this same principle? (adding query parameters to the end of the landing page urlL ?source=image  ?source=text, etc)

    Kristin

    Depending on your web analytics program, you should be able to accomplish it too by adding a variable at the end of the URL to track them that way.

    Eytan

  • Hi Gaea, Thanks for the article. It looks like this will be useful. However, I can't seem to get it to work properly.

    We have E9. At the bottom of the layout where it says "Page Header Script to be used for additional programming code:", I hit "New" and pasted the java into the page that came up. I updated the HTML form name, HTML field name, and query string parameter as you instructed in step 5. I noticed 2 things after doing this:

    1. On my published landing page, I now see the script typed out in the header. How do I make it invisible behind the form?

    2. When I tested submitting the form, I did not see the hidden field populate as expected.

    Fixing the first problem might fix the 2nd, but I thought both were worth mentioning.

    Any thoughts?

    Thanks for your help!
    Renee

  • gaea.connary
    gaea.connary Posts: 31 Bronze Trophy

    Hi Gaea, Thanks for the article. It looks like this will be useful. However, I can't seem to get it to work properly.

    We have E9. At the bottom of the layout where it says "Page Header Script to be used for additional programming code:", I hit "New" and pasted the java into the page that came up. I updated the HTML form name, HTML field name, and query string parameter as you instructed in step 5. I noticed 2 things after doing this:

    1. On my published landing page, I now see the script typed out in the header. How do I make it invisible behind the form?

    2. When I tested submitting the form, I did not see the hidden field populate as expected.

    Fixing the first problem might fix the 2nd, but I thought both were worth mentioning.

    Any thoughts?

    Thanks for your help!
    Renee

    Hi Renee,

    It sounds like you may not have pasted the script into an existing portion of Javascript -- you'll need to add opening and closing Javascript tags around it like so if not:

    <script type="text/javascript">

    [YOUR JAVASCRIPT]

    </script>

    Once these tags are in place, and your script is modified correctly given your specific form, the field population should work fine. Let us know if that resolves your issues.

    Regards,

    Gaea