2

Ok so we are running liquid web server

For some reason we are losing around 70% of all of our clicks that we are tracking on our end than we are seeing on Hasoffers tracking platform.

These are mobile clicks so we expect to loss a bit but not 70%

They say it can be a number of things that is causing this but I want to break it down here and show what we have so you can take a look at this a bit better and try to help us out.

So we are running traffic to variations of this link here

alengetcheck.us

For each phone number that we have we create a different domain.

So for instance alengetcheck.us/pndq8q is associated with 12547098787 and alengetcheck.us/pn7894 may be associated with 789278299

When sending out we do not use any sort of an HTTP, HTTPS or even WWW. We just run it as is the domain and the extension.

So the problem we are having is that when we are redirecting from alengetcheck.us/pndq8q to the other page it is taking about 1.7 seconds when we use a speed test and our score is very poor due to slow speed.

So the only thing that our system does is takes a link and redirects it. Very simple as we just have to redirect to the link set inside the link in the domain.

This is the script that we are currently using to redirect the link:

<?php 
function get($url, $params=array()) {   
   $url = $url.'?'.http_build_query($params, '', '&');
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   $response = curl_exec($ch);
   curl_close($ch);
   return json_decode($response);
} 

$link = get('http://aptrack.us/get_link.php', array('code'=> $_GET['code']));
echo "<script>window.location='".$link->url."';</script>";
?>

As you can see this is a very simple script and it shouldn't take 1.7 to redirect to the next page. It should take milliseconds.

So what should we do on our end now to make this go faster?

Is there anything wrong with our script or our calls that you see would cause a split second lag?

How can we reduce server response time to 200MS which is what Google is wanting from us right now?

Any help or suggestions would be great!

  • While I am slightly confused as to what you are doing exactly. A redirect is not just your code executing, it is the output being sent, parsed by the recipient, executed (since it is Javascript) and then a new request sent for the new page. At the very least you should sent an HTTP 301 or 302 redirect. – Itai Jun 27 '17 at 20:36
1

Just what Itai wrote, I am also confused what you are trying to achieve with your code.

What is the expected output from your Get-function? And why do you json_decode it?

If, for example you need to translate your ID (pndq8q or pn7894) to a number, then why is this relevant for redirection? I suspect you have those Hashes, then grab their corresponding ID from a list or database and then do the same thing again, but against your ID instead of the hash.

Why not grab the final URL directly?

Fake code

<?php 
function get($hash) {   
    // lookup your final link by your hash in your DB, store as $data
    return $data;
}

$link = get($hash); // this would be i.e. get('pndq8q');
header('Location: '.$link);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.