1

How can I get the email address from a URL to appear on my webpage with javascript or HTML with a website built on Ruby on Rails?

I have a URL like this:

http://dance.danceninjas.com/thanks-so-good?cf_uvid=1ce505f1e32477b73a15a514962e25b2&email=test324@gmail.com

And I want to pull the email address from the URL into the webpage so I can say:

Please verify your email is correct: <EMAIL_HERE>

I know that with WordPress I would use the PHP code:

echo $_GET["email"];

But apparently that won't work with websites built with Ruby on Rails.

I am using ClickFunnels to build my website, which means I have the ability to add Javascript into my footers and add snippets of custom HTML code.

Does anyone know how I can accomplish this?

Grimthorr
  • 6,856
  • 5
  • 41
  • 53

2 Answers2

2

If I understand correctly, ClickFunnels acts as a hosting and front-end construction platform that only gives you access to your page only through:

  • editing content
  • assigning pre-made templates
  • placing client-side JavaScript code

There's nothing Rails-specific you can use here. That would imply a lot of potential for security breaches. Execution of arbitrary Ruby can be done right, it's just rarely needed and thus rarely done.

That said, PHP-like solutions such as $_GET["email"]; won't work by principle. @rorofromfrance's answer has its right sides, but you can't make use of this because you don't own the platform and you can't modify the templates. It's not bad service design, there are some big advantages of this, the biggest of which is caching: a static page without any server-side processing can be placed in cache entirely and served through a CDN that can handle crazy amounts of traffic and stay up.

SO the solution is offloading that action for the client's browser. You pass parameters in a query string. This string is accessible through JavaScript (window.location.search), in raw format, like:

"cf_uvid=1ce505f1e32477b73a15a514962e25b2&email=test324@gmail.com"

That said, it should be split into keys and values before being used. And there are plenty of solutions for this under this question. Pick the one you like most.

Community
  • 1
  • 1
D-side
  • 9,150
  • 3
  • 28
  • 44
  • This is correct. You need to use JavaScript. Clickfunnels has jquery on all pages so you can use a jquery solution if desired as well. – Todd Dec 03 '14 at 12:40
  • @Todd you're the cofounder of ClickFunnels, right? I'd hoped that Jquery was included in my ClickFunnels opt-in page, but I don't see it being loaded, and I'm not sure how I can add it myself. Is it within https://www.clickfunnels.com/assets/lander.js? And it should be usable as usual? I wonder why I haven't gotten Jquery to work within my Custom HTML "element". I'm similarly hoping to be able to echo the name and email address of the provided opt-in data (on the thank-you page), perhaps by saving the form data to a cookie or localStorage (I'd prefer not to make it visible in the querystring). – Ryan Jun 14 '16 at 06:11
0

You would need to use Ruby language (if you can) which then would allow you to access URL parameters like this:

params[:email]
rorofromfrance
  • 1,854
  • 12
  • 21