WordPress.org

Forums

embed affiliate pop up in website page (2 posts)

  1. swilky
    Member
    Posted 1 year ago #

    Hi There

    I am building a website as an affiliate partner to a hotels travel agent.

    I have affiliate javascript code for the hotel search function on my home page which is working fine, however when I get the hotel search results these open in a pop up window. I would like to redirect this to a hotel search results page on the site where the search results are embedded in the page rather than opening up in a pop up.

    Are there any plugins that could do this for me or can anyone help with specific code?

    The website address is http://www.cubadaddy.com.

    Many Thanks

  2. Abhishek Ghosh
    Member
    Posted 1 year ago #

    I have affiliate javascript code for the hotel search function on my home page which is working fine, however when I get the hotel search results these open in a pop up window. I would like to redirect this to a hotel search results page on the site where the search results are embedded in the page rather than opening up in a pop up.

    It is basically about javascript modification or using API, not actually about WordPress. You can ask in StackExchange like Q&A forum for the needed modification of the code. However, modifying js code without permission from the original Advertising company (who supplied you the code) can make your affiliate status banned.

    You can split the searching function and display result to be shown in two windows by using simple HTML form function if API available, otherwise the session ID will break the result.
    Great example can be Google Custom Search. For example, if you click my name beside this post, you will land to my blog; where there is a Search box. If you input something and hit the search button, you will land to second page with result, which is essentially of Google. We can do it as Google Custom Search allows to do so. That is there is separate huge documentation of API.

    This is an example HTML code which is used to collect query and land to a separate webpage :

    For the widget, the prototype code needed for a text widget is :

    (Code 1)

    <input type="button" name="search" value="Search" onclick="window.open('/?page_id=41')">
    <input type="hidden" name="realname" value="$Name" />

    And you need to land them to cubadaddy.com/?page_id=41 (example) for showing up the results - that is an external webpage. So you need to iframe the results to make as if the results are from your website :

    (Code 2)

    <body>
    <iframe>
    // Fetches data from $Name field
    // custom code goes here
    
    </iframe>
    </body>

    (Code 3)

    From Code 1, we can add more field to GET more data and use it on Code 2 page. What these custom javascript does, they add a session cookie to add a layer of security to prevent click fraud, track etc. So essentially without the API it is not possible in your case.

    You can check any traditional HTML coding website like W3Schools for more info.

Topic Closed

This topic has been closed to new replies.

About this Topic