Solution to using UTM parameters & cookies to capture lead source information

Anonymous
Not applicable

Re: Solution to using UTM parameters & cookies to capture lead source information

Beth -

I am currently using the code shown in my original post.  However, as Sanford pointed out, it has its flaws, so use at your own risk. 

Anonymous
Not applicable

Re: Solution to using UTM parameters & cookies to capture lead source information

Hi Evan Vega

I used your code (with a small adjustment of checking whether a cookie is already set) using this code:

if (getCookie("utm_source").length < 1 || getCookie("utm_term").length < 1 || getCookie("utm_content").length < 1 || getCookie("utm_campaign").length < 1 || getCookie("utm_medium").length < 1) {

In this way the first set cookies don't get overwritten.

However I'm experiencing the problem of TypeError: elem is null. Do you have any idea how to deal with this?

Anonymous
Not applicable

Re: Solution to using UTM parameters & cookies to capture lead source information

I really wish the Munchkin code just took care of this for us, rather than each user having to Macguyver a solution. Frustrating!

Does anyone have a clear solution for this yet? Just looking to point our developer in the right direction.

Justin_Norris1
Level 10 - Champion Alumni

Re: Solution to using UTM parameters & cookies to capture lead source information

Jill Purse

If you want something that is more out-of-box, try Bizible: Bizible | B2B Marketing Attribution & Analytics Software

It "just works" out of the box, but is also very customizable/flexible for more unique requirements.

Web_Master1
Level 1

Re: Solution to using UTM parameters & cookies to capture lead source information

I took a stab at implementing the feedback from Sanford Whiteman and figured I'd share it even though I didn't end up using it. Note: I haven't actually tested the code below, so there are likely some issues. I'm just posting because it might be a better start than what's provided above.

Solution to using UTM parameters & cookies to capture lead source information. See https://nation.ma...

SanfordWhiteman
Level 10 - Community Moderator

Re: Solution to using UTM parameters & cookies to capture lead source information

Hi Rob!  Nice work there, but some red flags too...

You shouldn't use a timer/interval to integrate with Marketo forms, as they have their own robust event model, and similarly you don't need to manage your own hidden input elements... document.hasOwnProperty('cookie') doesn't really tell you anything about cookie support, and the domains setting doesn't seem to be used... and params[] = <value> is bad JS syntax (are you trying to append to the hash PHP-style?).

At any rate, I advise anyone interested in this area to check out ConversionPath (http://conversionpath.io/​).  I wrote the JS client piece, and it has seamless integration into the Marketo forms event model (as well as an integration into 3rd-party forms that I think is unprecedented) , a bunch of configurable bells and whistles, and is under continuous development.

Yanir_Calisar2
Level 3

Re: Solution to using UTM parameters & cookies to capture lead source information

See this Javascript that captures both first touch and last touch UTM params:

UTM-Tracking

https://github.com/yanirclsr/MarTech/tree/master/UTM-Tracking

Gunpreet_Kaur1
Level 3

Re: Solution to using UTM parameters & cookies to capture lead source information

Hi Yanir, Thanks for the js. We implemented the code on a page to test it out, ft fields are populating correctly on form submission but not lt(last touch). Is it suppose to pick the last touch just before the second-time form submission?

Also, what is the difference between utm-capture.js and utm-capture-hs.js ?