Announcement

Collapse
No announcement yet.

Keyword tracker. Where to place it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Keyword tracker. Where to place it?

    Hi there,
    I've been using 'digital point' site to track my keywords position.
    They have changed its system and now they're asking for us to place a code in our site. My question is how do I do that? Here's what they say in their site:

    You need to install this script on your web server (that supports PHP 5.2.0 or higher).
    In case you are wondering why you have to install a script on your server to enable these functions is because Yahoo and Bing limit the number of API requests made per day on an IP address basis. So this will make the requests from your server IP.
    Save this file to your web server that supports PHP (name it whatever you want, but be sure to give it a .php extension), then you can enter the URL in your preferences.

    Any ideas of how should I do it?
    Thanks a lot!
    N Z B R
    t o u r s
    New Zealand Tours
    Excursiones en Nueva Zelanda
    Nova Zelandia Pacotes e Roteiros
    Nouvelle Zelande Voyage
    Neuseeland Reisen

  • #2
    Re: Keyword tracker. Where to place it?

    No ideas?
    thanks
    N Z B R
    t o u r s
    New Zealand Tours
    Excursiones en Nueva Zelanda
    Nova Zelandia Pacotes e Roteiros
    Nouvelle Zelande Voyage
    Neuseeland Reisen

    Comment


    • #3
      Re: Keyword tracker. Where to place it?

      Right click a blank spot in your BV page, Page HTML and
      drop it at End of Body,

      <script type="text/javascript">
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
      try {
      var pageTracker = _gat._getTracker("UA-9228899-1");
      pageTracker._trackPageview();
      } catch(err) {}</script>
      Doable Personal Finance

      Comment


      • #4
        Re: Keyword tracker. Where to place it?

        Hi there,
        They've given me the code. Where do I place it is my question. If i put it at the 'end of body' as you've sugested, it comes up 'behind the page layout. Here is the code:

        <?php
        error_reporting(E_ALL & ~E_NOTICE);

        if ($_REQUEST['v']) {
        echo '2';
        exit;
        }

        function get_page($host, $url) {
        global $i, $fail_count;
        $handle = fsockopen($host, 80, $errno, $errstr, 30);
        if (!$handle) {
        if ($fail_count < 5) {
        $i--;
        $fail_count++;
        }
        } else {
        if ($_REQUEST['c']) $cookie = "Cookie: $_REQUEST[c]\r\n";
        fwrite ($handle, "GET $url HTTP/1.0\r\nHost: $host\r\nConnection: Close\r\n$cookie\r\n");

        while (!feof ($handle)) {
        $string = fgetc ($handle);
        if ($string == '<' || $string == '{') break;
        }
        while (!feof($handle)) {
        $string .= fread($handle, 40960);
        }
        fclose($handle);
        return $string;
        }
        }

        if ($_REQUEST['t']) {
        $query_order = array(1);
        } else {
        $num = 10;
        if ($_REQUEST['se'] == 'y') $num = 50;
        if ($_REQUEST['se'] == 'g') $num = 8;

        for ($i = 1; $i <= $_REQUEST['d']; $i += $num) {
        $query_order[] = $i;
        }

        if ($_REQUEST['l'] > 0 && $_REQUEST['l'] < 1001) {
        $x = $_REQUEST['l'] - 1;
        $y = $x - ($x &#37; $num) + 1;
        $query_order[$y / $num] = 1;
        $query_order[0] = $y;
        $slice = array_slice($query_order, 1, max (0, ($y / $num) - 1));
        rsort ($slice);
        foreach ($slice as $array_key => $value) {
        $query_order[$array_key + 1] = $value;
        }
        }
        }

        if ($_REQUEST['se'] == 'g') {
        $error = '';
        $fail_count = 0;
        for ($i = 0; $i < count($query_order); $i++) {
        @set_time_limit(30);
        $start = $query_order[$i];

        $data = get_page ('ajax.googleapis.com', '/ajax/services/search/web?v=1.0&rsz=large&start=' . ($start - 1) . '&q=' . urlencode ($_REQUEST['q']));
        $parser = json_decode($data, true);

        if ($_REQUEST['u']) {
        unset ($results_detail);
        $position = $start;
        foreach ($parser['responseData']['results'] as $result) {
        if (substr_count (strtolower ($result['url']), $_REQUEST['u'])) $results[] = $position;

        if ($_REQUEST['s']) {
        $results_detail[$position]['title'] = $result['title'];
        $results_detail[$position]['url'] = $result['unescapedUrl'];
        }
        $position++;
        }
        }

        $results_total = $parser['responseData']['cursor']['estimatedResultCount'];
        if ($error && $fail_count < 5) {
        unset ($error);
        $i--;
        $fail_count++;
        }
        if ($results) break;
        }

        } elseif ($_REQUEST['se'] == 'y') {
        $error = '';
        $fail_count = 0;
        for ($i = 0; $i < count($query_order); $i++) {
        @set_time_limit(30);
        $start = $query_order[$i];

        $data = get_page ('api.search.yahoo.com', '/WebSearchService/V1/webSearch?appid=keywordtracker&query=' . urlencode ($_REQUEST['q']) . '&start=' . $start . '&results=50');

        $parser = xml_parser_create('UTF-8');
        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
        xml_parse_into_struct($parser, $data, $vals, $index);
        xml_parser_free($parser);

        if ($index['ERROR']) {
        $error = $vals[$index['MESSAGE'][0]]['value'];
        }

        if ($_REQUEST['u']) {
        unset ($results_detail);
        $position = $start;
        foreach ($index['URL'] as $url_key) {
        if ($vals[$url_key]['level'] == 3) {
        if (substr_count (strtolower ($vals[$url_key]['value']), $_REQUEST['u'])) $results[] = $position;

        if ($_REQUEST['s']) {
        $results_detail[$position]['title'] = $vals[$url_key - 2]['value'];
        $results_detail[$position]['summary'] = $vals[$url_key - 1]['value'];
        $results_detail[$position]['url'] = $vals[$url_key]['value'];
        }
        $position++;
        }
        }
        }
        $results_total = $vals[$index['RESULTSET'][0]]['attributes']['TOTALRESULTSAVAILABLE'];
        if ($error && $fail_count < 5) {
        unset ($error);
        $i--;
        $fail_count++;
        }
        if ($results_detail) {
        if ($_REQUEST['s']) {

        $position_key = max(0, min ($results[0] - 4, count ($results_detail) - 10));
        $results_detail = array_slice ($results_detail, $position_key, 10);
        foreach ($results_detail as $result) {
        $position_key++;
        $results_new[$position_key] = $result;
        }
        $results_detail = $results_new;
        }
        break;
        }
        }

        } elseif ($_REQUEST['se'] == 'b') {
        $error = '';
        $fail_count = 0;
        for ($i = 0; $i < count($query_order); $i++) {
        @set_time_limit(30);
        $start = $query_order[$i];

        $data = get_page ('www.bing.com', '/search?q=' . urlencode ($_REQUEST['q']) . '&first=' . $start . '&count=10&format=rss');

        $parser = xml_parser_create('UTF-8');
        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
        xml_parse_into_struct($parser, $data, $vals, $index);
        xml_parser_free($parser);

        unset ($results_detail);
        $position = $start;
        foreach ($index['LINK'] as $url_key) {
        if ($vals[$url_key]['level'] == 4 && !strpos($vals[$url_key]['value'], 'www.bing.com:80/search')) {

        if (substr_count (strtolower ($vals[$url_key]['value']), $_REQUEST['u'])) $results[] = $position;

        if ($_REQUEST['s']) {
        $results_detail[$position]['title'] = $vals[$url_key - 1]['value'];
        $results_detail[$position]['summary'] = $vals[$url_key + 1]['value'];
        $results_detail[$position]['url'] = $vals[$url_key]['value'];
        }
        $position++;
        }
        }
        if ($results) break;
        if ($error && $fail_count < 5) {
        unset ($error);
        $i--;
        $fail_count++;
        }
        }
        }

        if (!$results) $results[] = 9999;
        $output['results'] = implode ('|', $results);

        if ($error) $output['error'] = $error;

        if ($_REQUEST['t']) {
        $output['total'] = $results_total;
        echo serialize($output);
        } elseif ($_REQUEST['s']) {
        $output['total'] = $results_total;
        $output['detail'] = $results_detail;
        echo serialize ($output);
        } else {
        echo serialize ($output);
        }

        ?>
        N Z B R
        t o u r s
        New Zealand Tours
        Excursiones en Nueva Zelanda
        Nova Zelandia Pacotes e Roteiros
        Nouvelle Zelande Voyage
        Neuseeland Reisen

        Comment

        Working...
        X