CalderaWP / Caldera-Forms

Drag and drop, responsive WordPress form builder.
https://CalderaForms.com
GNU General Public License v2.0
187 stars 163 forks source link

HTTP Referrer Ability #2894

Closed richgar07 closed 4 years ago

richgar07 commented 5 years ago

Do You Need Immediate Help?

Is This A Feature Request?

Please create an HTTP Referrer ability. Example: Customer clicks on a link in a Facebook post that takes them to a page that has a Caldera Form, they fill it out, then in the email the website admin receives is the url the customer lead came from. This provides a ton of value to the clients and helps Agency's with Caldera Forms stand out. This is a pretty standard feature for wp contact forms (contactform7, gravity form) so I think it would be pretty easy feature to quickly add.

Shelob9 commented 5 years ago

Thanks for using Caldera Forms. Some thaughts on this:

On one hand, we have this feature - There is a magic tag, {current_url}. You can make that the value of a hidden field, call the field "Refferer URL" and then you have what you need in the email.

Also, nothing about the fact that you can do this with Caldera Forms is obvious. I don't know if that's a documentation issue and a UI issue. or just a docs issue.

richgar07 commented 5 years ago

Hi Josh, Thanks for your response.

I have contacted your support and they mentioned that they don't have this capability and directed me to here. I'm looking for the referring website like Google Analytics uses to figure out Acquisitions. So yes there is the ability to see what page the customer came from on the website but that wouldn't be a referral because the site is mine/clients. I am looking for the url from the site that the customer was referred from. As an example, ContactForm7 does it well with their plugin https://wordpress.org/plugins/referrer-input-for-contact-form-7/. The ability to grab the HTTP Referrer.

richgar07 commented 5 years ago

I'm glad you brought up the magic tags because that would be a cool way for users to easily use or maybe it has to be a free add on to make it work. Either way it would be very beneficial to website owners so that they can easily see what channels are actually converting on the website and then becoming a customer. Finding out what sites convert the best is a bit easier for e-commerce when using Google Analytics but for service based businesses this is a game changer. It helps see where marketing dollars should go towards. Can be beneficial for all websites though.

Shelob9 commented 5 years ago

Thanks for the extra details. That helps me understand the problem your trying to solve.

I'm curious if using a utm_referrer argument in the URL, tracking it in Caldera Forms with the UTM field, so it shows up in the email, and the you cam reports that to Google Analytics as well works for you? I'm asking because if that solves your problem, this is a document issue that we can solve.

richgar07 commented 5 years ago

Totally true! We currently do that for clients that have a higher marketing budget. This is more work for us and the client since they/us would have to change url they created across the web or setup tag manager to auto fill. Agency's aren't looking to add more work on their end but create repeatable systems. The http referrer is very easy to setup and repeatable. I'm also not really looking to loose a feature switching to Cladera Forms. Do you have any other suggestions on creating the HTTP Referrer ability? Support made it sound like there is no way to do it on our end it would have to be on your end. Is that true or can I create hooks or a plugin that integrates with Caldera Forms? I have seen in every Wordpress wp-includes there is the following code but I'm not sure if tapping into this would do what the same thing the other premium forms do? You probably would.

Here is what is already in Wordpress includes functions: /**

/**

if ( $referer ) $nonce_field .= wp_referer_field( false );

if ( $echo ) echo $nonce_field;

return $nonce_field; }

/**

if ( $echo ) echo $referer_field; return $referer_field; }

/**

/**

$ref = wp_get_raw_referer();

if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) && $ref !== home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) ) { return wp_validate_redirect( $ref, false ); }

return false; }

/**

return false; }

/**

tmdesigned commented 5 years ago

2936

richgar07 commented 5 years ago

Hi Taylor, Looks like you figured out a way. What is the process to set it up? I have tried: Hidden Feild > Name: Get Referrer, Slug: get_referrer, Value: {get:referrer_url} Hidden Feild > Name: Get Referrer, Slug: get_referrer, Value: {referrer_url} Hidden Feild > Name: Get Referrer, Slug: get_referrer, Value: referrer_url UTM Feild > Name: Get referral url, Slug: get_referral_url, Value: referrer_url

tmdesigned commented 5 years ago

Actually what I submitted was a "pull request", i.e. a proposed code change to the plugin to do what you wanted. You cannot use it yet until (and unless) the maintainers like Josh decide to review and incorporate it.

In the meantime, you could accomplish something similar manually.

  1. Add a hidden field to your Caldera form
  2. Give the field a selector we can use later, like a class name "js-referrer-field"
  3. On the page where the form is rendered, use a combination of JS and PHP to populate the field
<script>
   jQuery( document ).ready( function(){
       var httpReferrer = "<?php echo wp_get_raw_referrer_url(); ?>";
       jQuery( '.js-referrer-field input' ).val( httpReferrer );
   });
</script>

Haven't tested that exact snippet, and directly injecting php values into a JavaScript variable is frowned upon, but I've done similar before in a pinch.

richgar07 commented 5 years ago

Thank you so much for putting that request in!

Shelob9 commented 5 years ago

The PR looks good. We have put this on the 1.8.1 branch and will do final test/ merge after 1.8.0 issues are cleared.

richgar07 commented 5 years ago

Fantastic! You guys rock! If it works I think this will be a great simple addition.

New0 commented 4 years ago

Closed via https://github.com/CalderaWP/Caldera-Forms/commit/d5d9a6255b09fda05c663f7e7b0dd1285c310baf