HandL UTM Grabber: Capture UTMs on your forms

By Haktan Suren
In Bestof
Apr 10th, 2016
111 Comments
12052 Views

This page is dedicated to HandL UTM Grabber and its documentation. Please comment down below if you have any question or future requests about the plugin.

HandL UTM Grabber

Major features in HandL UTM Grabber include:

  • Add hidden fields in your forms (incl. Contact Form 7, Gravity Form)
  • Pass UTM variables to major marketing tools such as ActiveCampaign, Vero, Aweber, Interspire and many more…
  • Hassle free implementation (no shortcodes). See below…

I – Installation of HandL UTM Grabber

It installs like every other simple plugins out there. So, no specific information needed in this section.

II – What can you do?

Capture all the UTM variables as soon as user hits your website (ANY page of your WP installation): One great feature of the plugin is the UTM variables are saved in client’s browser and even though there is no UTM variables in URL, the variables can still be accessible via shortcode across any page/widget of your website.

III – How to use?

1. WP’s native shortcodes

[utm_campaign] – Prints out utm_campaign variable.
[utm_source] – Prints out utm_source variable.
[utm_term] – Prints out utm_term variable.
[utm_medium] – Prints out utm_medium variable.
[utm_content] – Prints out utm_content variable.
[gclid] – Prints out gclid variable.
[handl_original_ref] – The URL from which the user came to your site
[handl_landing_page] – The very first page the user visited on your site.
[handl_ip] – The IP address of the user.
[handl_ref] – The URL which the user came from to the page you have the shortcode.
[handl_url] – The URL on which you placed the shortcode.

2. Input Field Wrapper

There are some places you are not able to use WP’s native shortcodes. One example is when you use HTML in WYSWYG editor. If you directly copy paste the HTML below in your WP editor, you will see that the shortcode breaks.

<input type="hidden" name="utm_campaign" id="utm_campaign" value="" />

In order to prevent this, we recommend using the following shortcode wrappers.

[utm_campaign_i]<input type="hidden" name="utm_campaign" value="%s" />[/utm_campaign_i]
[utm_source_i]<input type="hidden" name="utm_source" value="%s" />[/utm_source_i]
[utm_term_i]<input type="hidden" name="utm_term" value="%s" />[/utm_term_i]
[utm_medium_i]<input type="hidden" name="utm_medium" value="%s" />[/utm_medium_i]
[utm_content_i]<input type="hidden" name="utm_content" value="%s" />[/utm_content_i]
[gclid_i]<input type="hidden" name="gclid" value="%s" />[/gclid_i]

[handl_original_ref_i]<input type="hidden" name="handl_original_ref" value="%s" />[/handl_original_ref_i]
[handl_landing_page_i]<input type="hidden" name="handl_landing_page" value="%s" />[/handl_landing_page_i]
[handl_ip_i]<input type="hidden" name="handl_ip" value="%s" />[/handl_ip_i]
[handl_ref_i]<input type="hidden" name="handl_ref" value="%s" />[/handl_ref_i]
[handl_url_i]<input type="hidden" name="handl_url" value="%s" />[/handl_url_i]

You can safely use the shortcode wrappers in your HTML content without worrying about breaking the code.

3. Hassle Free Implementation (No Shortcode)

Upon ativation of this plugin, it will fill the elements named “utm_source, utm_medium, utm_term, utm_content, utm_campaign, gclid” AUTOMAGICALLY! (by element name, id and class)

Simple Examples:

<input type="hidden" name="utm_campaign" />
<input type="hidden" name="foo" id="utm_campaign" />
<input type="hidden" name="foo" class="utm_campaign" />

If you are already using one of those names either in your form element name, id, or class. You do not have to use the shortcode or shortcode weappers. HandL UTM Grabber will automatically fill the corresponding fields. Easy peasy eh?

When to use?

1. if you would like to pass UTM variables to another domain. You can simply append UTM variables into your destination URL like this

<a href="www.destinationURL.com?utm_campaign=[utm_campaign]&amp;utm_source=[utm_source]&amp;utm_term=[utm_term]&amp;utm_content=[utm_content]&amp;gclid=[gclid]">Click Here To Go >>> </a>

2. Submit UTM variables into your favorite email marketing tools (Lead Tracking)
Very detailed information and integration tutorials with major marketing tools (ActiveCampaign, Vero, Aweber) and other WP plugins (Contact Form 7, Gravity Forms, WordPress-to-lead for Salesforce CRM, Ninja Forms) can be found here

About the Author

Haktan Suren
-

Webguru, Programmer, Web developer, Graduate student & Father :)

111 Responses to “HandL UTM Grabber: Capture UTMs on your forms”

  1. Nathan Faulkner says:

    A few typos in the new documentation. Consider changing from:
    [handl_original_ref_i][/handl_original_ref_i]
    [handl_landing_page_i][/handl_landing_page_i]
    [handl_ip_i][/handl_ip_i]
    [handl_ref_i][/handl_ref_i]
    [handl_url_i][/handl_url_i]

    to:
    [handl_original_ref_i][/handl_original_ref_i]
    [handl_landing_page_i][/handl_landing_page_i]
    [handl_zip_i][/handl_zip_i]
    [handl_ref_i][/handl_ref_i]
    [handl_url_i][/handl_url_i]

    All the field names are currently “gclid”

  2. Nathan Faulkner says:

    My previous comment was stripped of its code 🙁

  3. Lawrence says:

    Hi,

    Does this plugin store the utm details in cookies?

    Or will it only work when the URL features the various UTM parameter.

  4. I need to pass the UTM throughout the site and when they click on an outbound link, can this plugin pass the UTM in the URL throughout the site?

    • Haktan Suren Haktan Suren says:

      Yes, this plugin exactly does what you are asking…
      First of all, as soon as you installed the plugin, all the utm variables will be “automatically” recorded in the cookie.
      Simply use this in order to pass the UTMs

      <a href="www.destinationURL.com?utm_campaign=[utm_campaign]&amp;utm_source=[utm_source]&amp;utm_term=[utm_term]&amp;utm_content=[utm_content]&amp;gclid=[gclid]" rel="nofollow">Click Here To Go >>> </a>
      

      Also check #1 of “WHEN TO USE?” section of this article…

      Let us know if you need any other help!

      • So in order to pass the UTM throughout the site, I have to add the shortcode to all my links? Great plugin by the way!

        • Haktan Suren Haktan Suren says:

          Yes…

          Btw, I have another solution (another plugin [not in WP plugins yet though]) that automatically appends UTMs to all the URLs on your website. Let me know if you would be interested in that. I can send you the link or maybe include it in this plugin as a feature.

          • Yes! That would be great, because I have menu items etc that I don’t want to go through and add that link to. Thank you very much!

          • Thanks again, let me know when you can send that to me, I am looking to get it implemented asap. Basically there will be different users coming into the site with different UTM’s and I just need to ensure that their specific UTM get’s carried throughout the entire site, and on outbound links that goes to our app. I believe with some tweaks this plugin is exactly what I need. Again, great plugin!

          • Yasser says:

            Hello, thank you very much for this really useful plugin.

            Btw… I’m also interested in the plugin which will allow me to automatically appends UTMs to all the URLs on my website.

            Would be great if I could get it.

            Thanks in advance.

          • Haktan Suren Haktan Suren says:

            Thank you for the feedback, Yasser. I am currently working on implementing that feature. I think I will release the new version of the plugin within a week or so.

          • Haktan Suren Haktan Suren says:

            Happy to announce that I have just released a new version v2.5 that auto appends UTM variables to all links. Update HandL UTM Grabber plugin to the latest to activate the new feature.

  5. F2 Fitness says:

    Hello,

    I’ve installed contact form 7 plugin along with Handl UTM grabber. However none of the UTMs are getting captured at the backend. What could be the issue here?

  6. Haktan Suren Haktan Suren says:

    I will send it to you as soon as I implement the code into the plugin. It will be within a week or so. I will update you here as well.

  7. horacio says:

    Hi, I’m trying to use your plugin to capture the information that other plugin (webinarignition) capture in a form, but apparently is not interpreting properly the information, here is an example to try to show you the problem:

    when I insert this:

    instead of put the UTM info, send this “HandL UTM Grabber”

    or with the shortcodes:
    [utm_campaign_i][/utm_campaign_i]
    this sends %s instead of the actual value of %s…

    do you know how can I solve this?

    the page hide the code of the first example, here is
    ….” “….

    with spaces so this forum don’t delete it

    input type=”hidden” name=”label:utmcantidadvisitas” id=”utm_campaign” value=”HandL UTM Grabber”

    I also tried these options:
    input type=”hidden” name=”label:utmcantidadvisitas” id=”utm_campaign” value=”[utm_campaign]”

    [utm_campaign_i] input type=”hidden” name=”label:utmterm” value=”[utm_campaign]” / [/utm_campaign_i]

    (with )

  8. Scott says:

    Is the new “every URL” feature fully implemented? Is it working?

    • Haktan Suren Haktan Suren says:

      Yes, it is implemented fully. Please go to http://yourdomain.com/wpplugins/wp-admin/options-general.php?page=handl-utm-grabber.php and check “Append UTM” to activate the feature. Please note that, Append UTM feature is still on BETA, I appreciate any feedback.

  9. Erik says:

    Hi, its only Working for me in the Article Text, not on Sidebar or Header and Footer.

  10. Sing says:

    Hi, your new update V. 2.5.2 broke our custom parameters somehow. The parameter is cb=[cb].

    On the old version (2.4), we get this http://behalftesting.wpengine.com/about/?utm_source=testsource&utm_medium=testmedium&utm_campaign=testcampaign&cb=true. cb=true is woking fine, this is a test site by the way.

    New version (2.5.2), we get this https://www.behalf.com/about/?utm_source=testsource&utm_medium=testmedium&utm_campaign=testcampaign&cb=%5Bcb%5D. Now all links on the site have the query parameter cb’s value stay at cb=[cb], and it’s not working.

    Could you please look into this? Thanks!

    • Haktan Suren Haktan Suren says:

      So let me understand this better. [cb] is the shortcode you append to your URL in your content. And somehow they are not recognized by WP (after the upgrade) as a shortcode so they are just printed as a shortcode (e.g. [cb])?

      It appears to be that you are using “Append URL” feature. Can you just confirm? Thanks!

  11. Alex says:

    Hi, Haktan!

    Is there Method to integrate your plugin into Woocommerce registration?

  12. Alex says:

    This really great idea, the thing all e-commerce shops need use

  13. Hello Haktan! I can’t thank you enough for making this plugin.

    I have a few questions about the plugin that I wanted to ask you. How can I join the slack channel

  14. Simon says:

    Great plugin, how do i add the shortcode to WooCommerce email order templates ?

    • Haktan Suren Haktan Suren says:

      Hi Simon, Not sure if WooCommerce allow shortcode on email order template, I will check it out and let you know soon…

    • Haktan Suren Haktan Suren says:

      Hi Simon,
      Sorry about the delay… I figured that you can do this in two different ways.

      Way #1
      Dashboard > WooCommerce > Emails > New Order > Copy File To Theme
      This will generate a PHP file under your theme folder. Edit the theme file your-theme/woocommerce/emails/admin-new-order.php

      Find the line start with

       do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
      

      and add those just under

      $fields = array('utm_source','utm_medium','utm_term', 'utm_content', 'utm_campaign', 'gclid', 'handl_original_ref', 'handl_landing_page', 'handl_ip', 'handl_ref', 'handl_url');
      foreach ($fields as $id=>$field){
          print "$field: ".do_shortcode("[$field]")."<br>";
      }
      

      Way #2
      Create a plugin OR just add this into the function.php under your-theme/ folder

      add_filter('woocommerce_email_order_meta_fields', 'handl_utm_grabber_checkout_field_order_meta_fields', 10, 3 );
      function handl_utm_grabber_checkout_field_order_meta_fields( $fields, $sent_to_admin, $order ) {
          if ($sent_to_admin){
      	$fields = array('utm_source','utm_medium','utm_term', 'utm_content', 'utm_campaign', 'gclid', 'handl_original_ref', 'handl_landing_page', 'handl_ip', 'handl_ref', 'handl_url');
      	foreach ($fields as $id=>$field){
      		$fields['handl_'.$field] = array(
      			'label' => __( $field ),
      			'value' => do_shortcode("[$field]"),
      		);
      	}
          }
          return $fields;
      }
      

      Hope it is helpful for you. If you have any further question regarding this, join our slack channel here

  15. Scott Covert says:

    Does this work in aweber? Been spending 5 hours trying. Happy to donate $20 if you can solve.

    you can check code here:
    http://jackcartertrading.com/list1/?utm_campaign=testcamp&utm_source=testsource&email=scott@scovert.com

    when it was set for /$ or whatever, that was the literal value sent through – same with [utm_campaign]

    • Haktan Suren Haktan Suren says:

      I see that shortcode is spitted on the form. It may be because shortcode is not allowed in the plugin you are using.

      Try using just the hidden input field as it is explained under “3. HASSLE FREE IMPLEMENTATION (NO SHORTCODE)”.

      <input type="hidden" name="utm_campaign">
      <input type="hidden" name="utm_source">
      <input type="hidden" name="utm_term">
      <input type="hidden" name="utm_medium">
      <input type="hidden" name="utm_content">
      <input type="hidden" name="gclid">
      • Scott Covert says:

        in aweber, when you make a new variable, you have to refer to it in forms as name=”custom variable”, instead of just “variable”

        I think that presents a big problem?

        • Haktan Suren Haktan Suren says:

          It doesn’t have to be “name” parameter. Can you assign them a Class or ID? If you can, simply assign it like class=”utm_campaign”. If not, please provide me the plugin you are using for AWeber or how you implementing it. I will try my best to help you out. Also, consider joining our slack channel for better conversation https://www.haktansuren.com/slack-handlwp.

  16. Scott Covert says:

    I am putting in aweber form as raw html text chunk in divi theme

    would it help if I put it in a code element rather than text element?

    not familiar enough with css or php to know how to implement class or ID, or how that would get the proper variable output into the aweber form

  17. Puneet says:

    Hey, I have just installed your plugin and this can really help me in tracking my campaigns well at the user level.

    I want to append my UTM variables to all URLs (and not just the landing page) and I have checked in the option ‘Append UTM variables to all the links automatically (BETA)’.

    But when I move from a landing page (homepage in this case) to another page on the website the UTM parameters are not being appended and they disappear.

    Homepage (UTM Coded)
    http://www.sitarambhartia.org/?utm_source=google&utm_medium=cpc&utm_campaign=brand-keywords

    But when I navigate to another page, the UTM codes disappear example – http://www.sitarambhartia.org/maternity-program/

    I need the UTM codes to be appended to all URLs from the initial landing page so can you please help me with the same.

  18. Patrick says:

    Hi Haktan, I have (hopefully) a quick question. I added the plugin to my WordPress site to pass UTM user ID numbers that I receieve on my landing page on to another domain.

    The idea would be have a URL like this: https://businessadvising.org/get-started/lending-club/?utm_medium=12345

    And when you’re on the page, from there, you would click on this link https://businessadvising.geteverwise.com/roles/1/sign_up and the “12345” example user ID would carry through.

    I set up that second link like this: https://businessadvising.geteverwise.com/roles/1/sign_up?utm_campaign=[[utm_campaign]]&utm_source=[[utm_source]]&utm_medium=[[utm_medium]]&utm_term=[[utm_term]]&utm_content=[[utm_content]]&gclid=[[gclid]]

    But, when testers click through, instead of https://businessadvising.geteverwise.com/roles/1/sign_up?utm_medium=12345 we’re seeing https://businessadvising.geteverwise.com/roles/1/sign_up?utm_medium=utm_campaign

    Any idea what I’m doing incorrectly?

    • Patrick says:

      Sorry, forgot to add the code classes. Here’s how the second link is set up:

      https://businessadvising.geteverwise.com/roles/1/sign_up?utm_campaign=[utm_campaign]&utm_source=[utm_source]&utm_medium=[utm_medium]&utm_term=[utm_term]&utm_content=[utm_content]&gclid=[gclid]

      • Haktan Suren Haktan Suren says:

        Your implementation seems correct. I was wondering why you are not using the “Append UTM” (make sure you are on latest version) feature? It is under Settings > HandL UTM Grabber. It does this automatically without you having to do it manually. Let me know how it goes.

  19. Lane says:

    Hey Haktan,

    Love this plugin! If someone comes to my website with the UTM string attached (lets say via a text ad), then leaves, and comes back later via a link without the utm string (lets say organically or types in the url directly) will the plugin still recognize that the person came to the site originally with the UTM string and attach it? This is of course assuming this person doesn’t block cookies and didn’t clear their cache or anything.

    • Haktan Suren Haktan Suren says:

      Hi Lane,

      Thanks for the feedback. I am glad you find it useful.

      About your question, yes you are right. The user will be tagged with the same UTM after second visit (even though w/ no UTM) FYI, the cookies are set to expire after 30 days.
      Let me know if you have any other question.
      Cheers,

  20. Eduardo says:

    Hi!

    I’m using the plugin “Retarget Engine” to load facebook pixel codes when I redirect the clients do the checkout page, because the checkout page is outside my domain. I tried do use [[utm_content]] in the destination URL on the Retarget Engine plugin, but does not working. How can I solve this?

  21. yivgeni says:

    Hi,

    Awesome plugin!

    It passes the UTMs no problem and shows the previous page and the form origin page well. However, I get intermittent results with the referral and landing page – sometimes it works sometimes it doesnt. Usually if i land directly on the form page it works but if i browse it wont capture it. I get random page addresses that i didn’t even visit.

    Here’s the link:

    http://www.metrocompactor.com/commercial-marathon-equipment/self-contained-compactors/rj-100sc-series-compactors/ (form is at bottom)

  22. yivgeni says:

    ah! That explains it! Thank you very much

    This is such a great plugin 🙂

  23. Alan says:

    Great tool thank you.
    Unfortunately I am working with a form tool that insists on rewriting form element names. In your example above class=”utm_campaign” can work. What if there are other styles in that element eg class=”mauticform-hidden utm_campaign” ?

    • Haktan Suren Haktan Suren says:

      Hi Alan,
      Have you tried using the other methods (e.g. shortcode)? Can you let us know more about the way you are using the plugin? Thanks!

      • Alan says:

        Hi Haktan, at the moment the forms are being added via a line of javascript which gives me limited control. I am trying my best not to have to replace ALL forms with their HTML version.
        If multiple elements in a class does not work then i might not have a choice.
        Thank you for the reply.

  24. Jay Akin says:

    Hi Haktan,
    Seems like the parts after %20 is cut out of the utm values. %20 is automatically replaces space when you use google url builder to generate links with utm codes. Is there a solution for this, where the whole content for the utm tag is captured instead of the piece until the %20?

  25. Clare Wilson says:

    Hi Haktan

    This is working well elsewhere on our site but please could you help me work out why the UTM codes aren’t being passed through on our “Back to Summit” button on this page?

    https://summits.brighttalk.com/summit/digital-banking-2/its-all-in-your-hands-mobile-banking-apps-and-personal-finance/?utm_source=TestTimes&utm_medium=NewspaperJuly&utm_campaign=TestMcTestfacePromo

    Thanks!

    Clare

    • Haktan Suren Haktan Suren says:

      Hi Clare,
      Please note that auto append feature is still on beta. It is not guaranteed that it auto appends to every anchor link on the page.

      In your case, it seems like “Back To Summit” link is one of the exceptions. Your theme seems like custom coded, so I am not fully sure what’s going on until i see how it is coded. My guess is that it is either rendering after page load or it is not using proper WP functions (e.g. nav_link etc.). May I ask why you want to append the UTMs on that button? UTM Grabber works COOKIE based, that means when user lands on your page, UTMs are recorded in client’s COOKIE and then pass to the forms. I would be happy to help if you have more questions. You can reach out easier via joining our Slack channel.

  26. Lawrence says:

    Hi,

    How easy would it be to tweak the plugin so that and additional variable?

    For example, http://www.mysite.com?salute=hello

  27. Mark says:

    I have the “Append UTM variables to all the links automatically (BETA)” unchecked, but it still appends the variables to each link. I could surely poke around and remove it, but don’t want to break anything. Can you tell me how to only use the variables on-demand (such as shortcode). I only need it to write to gravity forms inputs, and not carry the variables in the url.

    Please and thank you.

  28. Mark says:

    The cookie piece is all I was really after. Just the cookie to grab the variables on the submit and add to our CRM to track from inception through a long sales cycle.

  29. Maor says:

    Hello,
    Can I stop the saving of the utm var to the browser? I don’t want to send utm to my lead system when there is no utm in the address.

    Thank you.

    • Haktan Suren Haktan Suren says:

      The plugin default is not to record anything in COOKIE if no utm provided in URL. So I am not sure what kind of problem you are having. Can you give me a URL to see the problem? Thanks!

  30. Mark Murnahan says:

    I’m giving it a whirl. It looks like it is working the way I hoped. I’ll let you know if I run into anything.

    Thank you for the great support, Haktan Suren.

    Cheers!

    Mark

  31. dorian logan says:

    Is it possible to set a TTL for UTMs – so we can set how long the UTM is valid for – from it first being set.

    • Haktan Suren Haktan Suren says:

      Hi Dorian,
      Unfortunately, there is no way to set a TTL for UTMs as of version 2.5.10. But this has been brought to me by couple more people. And I think it is a great idea. I will implement this in future releases and let you know. In the mean time, I can give you some more info about how to do it editing the version you have if you are interested in.

Wrap your code in <code class="{language}"></code> tags to embed!

Leave a Reply

E-mail address is required for commenting. However, it won't be visible to other users.

Loading Facebook Comments ...
Loading Disqus Comments ...