How to Pass keyword referrer info through iFrame?

3 replies
Hi Guys,

I would like to pass keyword referrer info through an iframe. Basically, I have a form which I have to iFrame on a website however; if I just iframe the form, the keyword referrer doesn't jump the iframe and I get lead/info without any referrer related to it.

For instance, using this code I am able to capture the title of the page the lead came from:

PHP Code:
<iframe style="margin-right:0px" scrolling="no" src="http://domain.com/form-i-am-iframing/?utm_content=WORDPRESS-POST-TITLE-FUNCTION" width="300" height="500" scrolling="auto" frameborder="0"></iframe
Using something similar.. how can I capture the keyword referrer if someone lands on a particular page of my site using "some keyword"? :confused:

Thanks for your help guys!
#iframe #info #keyword #pass #referrer
  • Profile picture of the author Brandon Tanner
    You can get the referring URL using HTTP_Referer (PHP) and then parse out the referring keyword from that, but it's not very reliable for several reasons. But if you're content with being able to grab that info from only a certain percentage of your visitors (which is all you can hope for), then you can do something like this.

    Once you have that info, simply echo it out in your iframe src's query string. For example (assuming that you put the referring keyword in a variable name 'keyword')...

    <iframe src="YourWebsite.com/FormSubmit.php?keyword=<?php echo $keyword; ?>">

    Then in the FormSubmit.php code, you would grab the value of the keyword that was passed through the query string...

    <?php
    $keyword = $_GET['keyword'];
    ?>
    Signature

    {{ DiscussionBoard.errors[7362304].message }}
  • Profile picture of the author StewartJ
    Thank you Brandon.

    In your opinion is there a more inclusive way to get keyword referrers and send them to the iFrame?
    {{ DiscussionBoard.errors[7362643].message }}
    • Profile picture of the author Brandon Tanner
      Originally Posted by StewartJ View Post

      Thank you Brandon.

      In your opinion is there a more inclusive way to get keyword referrers and send them to the iFrame?
      You can get the referrer using other languages as well (ie Javascript, Ruby, ASP, etc), but you will still have the same problem as with the PHP method. Which is... the referrer info will not always be passed to your page in the first place, because of many possible reasons (browser settings, popup blocker, firewall, etc etc).

      So no matter what language you use to get the referrer, it's never going to be 100% reliable.
      Signature

      {{ DiscussionBoard.errors[7362737].message }}

Trending Topics