# Landing Page: Local

Keitaro stores locally the landing pages with type Local.

# Requirements

HTML:

  1. Main page must be named index.html.
  2. Avoid <base /> tag. Keitaro uses that tag to correctly load images and style sheets.
  3. Avoid auto-refreshes, js-redirects and anti-bounce scripts.

PHP:

  1. Main page must be named index.php.
  2. Forbidden functions exec(), system(), job_start(), eval().
  3. If code loads scripts with include() or require(), it must specify the full path (using dirname(__FILE__) or an alternative).

Example:

  • require_once dirname(__FILE__) . '/src/lib.php'; is correct.
  • require_once 'src/lib.php'; isn't correct.
  1. Maximum page load is 3 seconds. If the code makes http requests, it must set the request timeouts. Example:

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); 
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
1
2

# Making ZIP file

Prepare on you computer a folder with the files of the landing page.

  • (Windows) Press right mouse button and choose Compress to ZIP file.
  • (macOS) Press right mouse click and choose Compress.

# Uploading ZIP file

Press Choose file or drop the file on the field:

Fill other settings if needed, then press Create.

  1. Open the landing page in the Editor.

  2. Set up JS Adapter on every page of the landing page.

  3. Create offer link using /?_lp=1 as href.

Example:

<a href="/?_lp=1">Offer</a>
1

Example of making links to multiple offer on the one page:

<a href="/?_lp=1&offer_id=10">Offer ID 10</a>
<a href="/?_lp=1&offer_id=22">Offer ID 22</a>
1
2
Alternative solution

That link opens a random offer from the flow:

<a href="{offer}">Offer</a>
1

To send to specific offer, add &offer_id=ID. Example:

<a href="{offer}&offer_id=100">Offer 1</a>
<a href="{offer}&offer_id=200">Offer 2</a>
1
2

# Sending postback

  1. Open the landing page in the editor.

  2. Set up JS Adapter on each page of the landing page.

  3. Set up Postback.

Alternative solution
  1. Open the landing page in the editor.

  2. Find the form.

  3. Add to the form <input type="hidden" name="_subid" value="{subid}" />.

Example:

<form action="submit.php" method="post">
    
    <input type="hidden" name="_subid" value="{subid}" />
    
    <input type="text" class="form__input" name="name"  placeholder="Your Name">
    <input type="tel" class="form__input" name="phone"  placeholder="Phone Number">
    <button class="btn form__btn" type="submit">Submit</button>  
</form>
1
2
3
4
5
6
7
8
  1. Open the PHP file that processing the form data.
  2. Use $_POST['_subid'] to get subid.

Example 1:

file_get_contents('POSTBACK_URL?status=lead&subid=' . urlencode($_POST['_subid']));
1

Example 2:

$data = array(
  'sub1' => $_POST['_subid'], // <---- that parameter is added
  'name' => $_POST['name],
  ...
);
1
2
3
4
5

# Updating parameters

Read page Updating Parameters page.

# Protecting from direct visits

  1. Open the editor
  2. Open index.php (rename index.html to index.php if needed).
  3. Add that code to the top:
<?php
if (!isset($rawClick)) {
  die();
}
?>
1
2
3
4
5
How to protect on the flow level?
  1. Add filter Parameter.
  2. Type name external_id, value @empty and mode NO.

That prevents opening the flow without external_id parameter.

# FAQ

Why images doesn't work?

Paths to images must be relative (without / in the beginning). Example:

  • <img src="/home.png" /> is incorrect.
  • <img src="/img/home.png" /> is incorrect.
  • <img src="home.png" /> is correct.
  • <img src="img/home.png" /> is correct.
Why local landing showing Timed out?

This message is shown when landing page exceeded maximum execution time. Current maximum execution time is set in "Execution timeout for local landing pages and local offers" param. It can be found in Maintenance → Settings → Main menu. Maximum value is limited to 9 seconds.

worker error EOF

Possible reasons

  1. The landing page contains PHP redirects.
  2. The landing page code contains "FATAL" errors. See System Log page.
Why page redirects immediately to `/lander/name/index.html`?

It means the landing page contains some script inside that make that redirect. You must find and remove it.

Why popups doesn't work?

That means the popup uses href attribute. For example, <a class="slow-scroll" href="#form2">order</a>. You may host that landing page somewhere and use redirect instead of Local.

Why JS script doesn't work?

Open Browser's Developer Console and check if there's an error.

How to pass parameters from traffic source through landing page?

See Passing Traffic Source Parameters page.

How to use Facebook Pixel?

See FB Pixel page.

How to use TikTok Pixel?

See TikTok Pixel page.

::: Why smooth scrolling doesn't work?

Look for a JS code, function or a separate method in the landing page that uses $('html, body').animate({…}).

The .animate() Method. is a built-in method for the jQuery library that performs the animation.

This method used in selector.Click() or selector.on('touch, click) method: selector.click(function() { $('html, body').animate(positionSelector , timeAnimate); }).

Find the specified selector. It's probably a link with a class. The class is specified as a selector. For example: <a class="to_form" href="#">link</a>.

Needed to change all links if the scroll animation doesn't work.

Wrap the link in a <span> tag, and specify the class of the link to the tag. We remove all attributes from the link (class and href).

As a result, we get: <span class="to_form"><a>link</a></span>

How to show date and time?
echo (new DateTime(null, new DateTimeZone("Europe/Moscow")))->format("Y-m-d H:i");
1