Script for Traffic Source and Medium to capture on Lead Gen Form


Currently I use utm_source and utm_medium and I capture those info using hidden fields. Those work great with external linking and custom campaigns. 

What I want to do is to capture the traffic source and medium not from external campaigns to the landing page, but from our own website in the same domain. Is there a script for traffic source and medium similar to capturing the referrer data in unbounce documentation? Does anyone know where I can get that?

Ideally, when the script is implemented, traffic coming to the main website will be passed on to the landing page. So if someone entered our site via (direct) traffic, organic search, or referral, and ended up signing up for our service on an unbounce landing page, that traffic source/medium will be captured on the form. 

Here’s a link that I’m currently using that may be helpful for this: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#trafficsour…

Please help! Thanks!


2 replies

I’m looking to do this too. Does this work?

(Under: Capturing Referrer Data in Your Lead-Gen Form)
http://documentation.unbounce.com/hc/en-us/articles/204326280

This is a problem we recently solved.

If you are using a button, click the option to “Pass  through URL Parameters”.

For links in Unbounce, we use a script to pass the utm tags to every link on a page. This worked because there wasn’t much navigating between pages since we try to get them to complete the lead form as soon as possible. Here is the script I used:
https://gist.github.com/philbar/7f6366b4af5636d80898

On our main website (WordPress) we saved the information in a cookie and then pass it to our Wufoo form. This was a better solution than the script above because our visitors viewed dozens of pages before converting. This solution was written with PHP so it won’t work with Unbounce.

Reply