vicioalex
Crea tu propio contador de visitas para tu blogger o pagina web, totalmente personalizable desde cualquier URL
Este tutorial que haré a continuación es para usuarios mas avanzados, comparto esto porque a mi me fue de mucha utilidad para mi web de Frases; http://fraseebook.blogspot.com

Creando esta web me surgió la necesidad de ponerle un contador de visitas a cada Post, buscando por la red algun contador que me sea util me encontre con esta publicación pero tiene limitaciones ya que solo se podía ver las visitas dentro de la entrada, pero si querías verlo en la portada principal de blogger no se podía y no funcionaba.
Asi que me las ingenie para programar un codigo que me permita visualizar las visitas de cada post en todos los lugares de mi blogger, ya sea en la portada, dentro del post, en relacionadas o en donde sea.

Ejemplo demostrativo



  • Lo primero que tienen que hacer es crear 2 archivos con extencion .php
  • Me pondré el caso que quiero saber la cantidad de visitas de esta URL: http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html

El primer archivo lo llamaremos "contador.php"

  • Lo que hara este archivo es generar automaticamente un archivo de texto .txt con este nombre: http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html.txt
  • Resulta muy largo y engorroso el nombre de ese archivo, es por eso que uso la funcion replace en PHP para desaparecer algunas cosas de la url y al final obtener un archivo con este nombre: 2012-08-crea-tu-propio-contador-de-visitas-para.txt
  • En la linea 5, 6, 7 use la funcion replace
  • Otro punto importante es con que cantidad de visitas desean que empiece el contador, por ejemplo si desean que empiece con 100 visitas como punto de inicio, solo tendrán que cambiar en la linea 9 y 24 el numero "1" por "100". De esta manera el contador mostrara 100 visitas para esa URL
<style>body {margin:0}.contador {font-size: 11px;font-weight: bold;font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;background-color: #fff;}</style>
<!-- Contador de Visitas personalizado - vicioalex.com -->
<div class="contador">
<? $conta=$_GET['v'];
$conta  = str_replace("http://vicioalex.blogspot.com/","",$conta); 
$conta  = str_replace(".html","",$conta); 
$conta  = str_replace("/","_",$conta); 
$archivo = "$conta.txt";
$contador = 1;
if (file_exists($archivo)) {
$fp = fopen($archivo,"r");
$contador = fgets($fp, 26);
fclose($fp);
$contador++;
$fp = fopen($archivo,"w+");
fwrite($fp, $contador, 26);
fclose($fp);
echo "$contador Visitas";
return;
}
else {
$fp = fopen($archivo,"w");
fwrite($fp, $contador);
echo "1 Visitas";
fclose($fp);
} ?>
</div>
<!-- Contador de Visitas personalizado - vicioalex.com -->

El segundo archivo lo llamaremos "contador2.php"

  • Aqui no hay nada que modificar, excepto si cambiastes la cantidad de visitas de inicio, si pusistes que empiece con 100 visitas, entonces deveras cambiar en la linea 11 el "1" por el "100"
<style>body {margin:0}.contador {font-size: 11px;font-weight: bold;font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;background-color: #fff;}</style>
<!-- Contador de Visitas personalizado - vicioalex.com -->
<div class="contador">
<? $conta=$_GET['v'];
$conta  = str_replace("http://vicioalex.blogspot.com/","",$conta); 
$conta  = str_replace(".html","",$conta); 
$conta  = str_replace("/","_",$conta);
if (file_exists("$conta.txt")){ 
include("$conta.txt");
}else{ 
echo "1"; 
} ?> 
Visitas</div>
<!-- Contador de Visitas personalizado - vicioalex.com -->

Este es el codigo que pondremos en la pagina donde queremos que empiece a contar (contador.php)

  • En la linea 2 esta el IFRAME que hara el conteo de las visitas usando esta url: http://tu-pagina-web/contador.php?v=http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html
<div class="contador">
<iframe frameborder="0" height="11" scrolling="no" src="http://tu-pagina-web/contador.php?v=http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html" width="70"></iframe>
</div>
<img src="https://lh5.googleusercontent.com/-5gS0H8kHpUI/UByrL-pZqmI/AAAAAAAABSc/mMWQYaCu7Q0/s30/estadisticas-frases.png" border="0"/>
<style>.contador {margin-left: 30px;position: absolute;margin-top: 10px;}</style>

Este codigo es solo para visualizar la cantidad de visitas, pero no hara el conteo de visitas (contador2.php)

  • En la linea 2 esta el IFRAME que hara visualizar la cantidad de visitas, mas no hara el conteo: http://tu-pagina-web/contador2.php?v=http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html
<div class="contador">
<iframe frameborder="0" height="11" scrolling="no" src="http://tu-pagina-web/contador2.php?v=http://vicioalex.blogspot.com/2012/08/crea-tu-propio-contador-de-visitas-para.html" width="70"></iframe>
</div>
<img src="https://lh5.googleusercontent.com/-5gS0H8kHpUI/UByrL-pZqmI/AAAAAAAABSc/mMWQYaCu7Q0/s30/estadisticas-frases.png" border="0"/>
<style>.contador {margin-left: 30px;position: absolute;margin-top: 10px;}</style>

Trate de ser lo mas resumido posible, cualquier duda me escribes aqui.

Entradas Relacionadas

Siguiente
..
Anterior
..
Compatir esta publicacion:
VicioAlex Publicado por: Unknown | VicioAlex Categoria: , | El: 07 agosto 2012 , A las: VicioAlex 6:59 p. m.
Comentarios por Facebook:
Comentanos tu opinion es muy importante, deja tus comentarios, te aseguro serán contestados, dudas, sugerencias, lo que sea!!!!!!!!!!.
vicioalex A
Personas les gusta esto.
8 comentarios por Blogger:
vicioalex A 8 Personas les gusta esto.
With a 60 day maturity, turnips need to be in the ground by August 15.

Louis, a new delivery tradition has been created: the "Mulch Man. In this same respect, mulch aids in the prevention of soil splashing onto plants.

Also visit my weblog; mulching
Today there is still plenty of activity in all the area
mines. It also happens sometimes that your character
will say something silly. Gold is a platinum widely adorned and also highly valued
globally.

my blog post mining
This will give you an idea on the reputation of the company.
Some of the papers that come out only once a week have managed to gather a large number of readers.
The news that you as a reporter tend to report
must be based on fact. They also delight in the creativity provided by the activities.
The higher the or TC the softer and more lustrous the fabric and
the more durable and less prone to shrinkage.


Feel free to visit my page :: egyptian newspapers
Stream Direct TV is Unlike Anything I've Seen Available at such a low price: Stream Direct Tv is an innovative application that will let you watch over 4500 Digital HD channels by streaming the video feeds. Yet as soon as again, to my dismay, the buffering was very good high quality and watching TV was enjoyable. It's extremely obvious that they have never
seen the show. You may have to commit to a minimum time period for a package.
On top of that, throw in a mysterious force on the island these people are all stranded on, and enigmatic characters
called The Others and two corporations which have tried
to exploit the the island and you have a heady mix of
action, drama and mystery.

Here is my blog post :: Satellite direct
If there's give in the stakes or the form, neither of them are doing their jobs correctly. Polished concrete floors come in different colours and types to suit the different decorative and functional requirements of domestic or commercial customers. This Wednesday night there is a lot going on in Atlanta.
Hair that is thin will benefit from lighter oils while hair
that is coarse will benefit from heavier oils. Just focus on one
herb at a time that suits your present needs.
Once you have determined what kind of texture your hair has, you can then start
using one of the techniques described below to improve
it. Khas (Vetiveria Ziziniodis):- used as an effective
hair restorer. * Apply oil unto your hair - Run your fingertips
through your hair and rub it in an even way.

my site: hairstyles for women
Use oils that can help keep your hair soft and
manageable. Amla is used in the preparation of
a highly effective natural shampoo by mixing 100 g each
of amla, nuts and Shikakai soap in two quarts of
water, the mixture is boiled for half an hour
to simmer and then can be used as shampoo for one month for
all hair treatment throughout the year. You repeat the exact same procedure maybe once or twice every week.
Yet, lack of moisture can also cause breakage, split-ends and
brittle hair. * Apply oil unto your hair
- Run your fingertips through your hair and rub it in an even
way.

My web page how to grow hair faster
It is also a good idea to avoid any accidents, slips or falls.

When you decide to buy the Flight simulator Game, then first you have to be sure that exactly
what are you want. You must, however, practice auto-rotations at the flying field
with the help of an instructor. In order to compete for market shares on routes you must
have a virtual airline management game account.

In general, it is something manufactured, to pretend to be (or simulate), something else more valuable.
vicioalex
Entradas Recientes