WebSite X5Help Center

 
A. Remus
A. Remus
User

Can i recive a email or count evry time a user hit a certain page on my website  en

Autor: A. Remus
Visited 527, Followers 1, Udostępniony 0  

Hello. Maybe for many of you it seems a silly question / ideea but for me is a really struggle and since most of time i was found help here i decided to ask.

So basicaly what i need is even to recive a email whan a user hit a certain page from my website (so not all the pages) or somehow to count externaly (i know well hitcounters from internet and is not what i need) on a dashboard or something.

Many thanks in advance.

Remus A

Posted on the
20 ODPOWIEDZI - 1 POMOCNY
John S.
John S.
User

I am not sure exactly what you need but here is some suggestions:

Google Analytics: With this tool you can see which pages is "used". You can see from where your users is coming from (countries, cities) and how long they stay on your pages. You can even see in real-time which page is visited and where the user comes from. Also what device is used and the browser.

Google Search console: Here you can see which pages is shown in Google searches and which position. You can see if how many "shows" that resulted in a click for a page.

In both tools you can "design" reports.

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

Screenshot from Google Analytics Real-time view.

Czytaj więcej
Posted on the from John S.
Claudio D.
Claudio D.
Moderator
Najlepszy Użytkownik miesiąca IT

@Remus

If you just need to get an e-mail when a user opens a particular page...
you just need to put instructions in PHP that send you the email , the page needs to be .php and not .html
If you search in the net you will find several ideas for doing this....


This is an example of the code you need.

put it, in HTML object.

Czytaj więcej
Posted on the from Claudio D.
John S.
John S.
User

I see that Claudio has a more direct answer to your question. I thought of the same, but could not see why you should need that without having any information other than your page had been visited.

Maybe you want to see if a visitor is recurring?

This could be done somewhat like this:

<?php

// set your e-mail address first, where you'll receive the notifications - use mail from own domain

$yourEmailAddress = "***";

$emailSubject = "Someone visited Webpage: yourpagename";

$remoteIpAddress = $_SERVER['REMOTE_ADDR'];

$emailContent = "Someone visited your webpage. IP address:".$remoteIpAddress;

// send the message

mail($yourEmailAddress, $emailSubject, $emailContent);

?>

If you don't need the IP, then you should use the answer given by Claudio 

@Remus - maybe you could tell some more of what it should be used for.

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

$yourEmailAddress = "***";

should be

$yourEmailAddress = "user(at)domain(dot)com";

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

You could also store information in a database. Timestamp and IP. Maybe even some geo-loacation

This will make it possible to make statistic on the page visits. It could be used in combination with the mail-sending.

But why then not use what I suggest in my first post.

Czytaj więcej
Posted on the from John S.
A. Remus
A. Remus
User
Autor

Thank you. 

Exactly like you supossed. I need to know if a certain user was visited a certain page. The first part i was solved because on that page only that user have acces. I vill give a try with your ideea. Google analitics unfortunetly even it work and i have on my website do not fullfill my needs.

Thank you. After give a try i will come back.

Czytaj więcej
Posted on the from A. Remus
John S.
John S.
User

You can put the following in a html-object on the page you want to monitor.

It will log a line in a txt-file (logfile.txt) The file will be created if not existing. Depending of how many "logs" will be in the file you could download it to your desktop every week/month/year and then delete it on the server. A new file will be started and so on.

The IP and the date (when the page initial is accessed) will be logged. You can style the date and time format as you wish. I think that logging will be better for you than the mail. And there is no database involved doing it this way.

<?php

function logIP()
{
$ipLog="logfile.txt"; // Your logfiles name here (.txt or .html extensions ok)

// IP logging function original by Dave Lauderdale
// Originally published at: www.digi-dl.com

$register_globals = (bool) ini_get('register_gobals');
if ($register_globals) $ip = getenv(REMOTE_ADDR);
else $ip = $_SERVER['REMOTE_ADDR'];

$date=date ("l dS of F Y h:i:s A");
$log=fopen("$ipLog", "a+");

if (preg_match("/\\bhtm\\b/i", $ipLog) || preg_match("/\\bhtml\\b/i", $ipLog))
{
fputs($log, "Logged IP address: $ip - Date logged: $date<br>");
}
else fputs($log, "Logged IP address: $ip - Date logged: $date\
");

fclose($log);
}
// Place the below function call wherever you want the script to fire. Keep it here to log page visits.
logIp();


?>

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

You can have more logs - one for each page - by changing the name for the logfile for each page like:

logfile01.txt  on one page

logfile02.txt  on another page

logfile03.txt  on another page  and so on.

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

****  The page must be of type PHP.

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

If you want to use the logging also on html.pages you can have the script in a PHP-file you "call" from a html.page using a PHP include inside the html.

The script can be made so it logs: IP, city, country, device type, platform and date and time.The city may not be very accurate.

Czytaj więcej
Posted on the from John S.
John S.
John S.
User

Hello Remus

Have you seen this: https://helpcenter.websitex5.com/pl/post/263273

Maybe it is something that you could use. It can be used on a whole X5-project by just inserting one line of code - or on specific pages whatever they are html or php pages.

Czytaj więcej
Posted on the from John S.
A. Remus
A. Remus
User
Autor

Hello. Yes that's crazy nice. Unfortunetly as you guessed i am simply unable to do that all by myself. But YES is something really nice. 

Czytaj więcej
Posted on the from A. Remus
John S.
John S.
User

I guess it was you that just visited from RO.

If you will help testing, then I will help you by installing when test has ended. Just one folder to install on your server and one line in your X5-project, so maybe you will be able to install without help.

I expect it will be in the coming week the testing will be finished.

You could help by accessing the site with different devices and then report if the shown information is correct.

Czytaj więcej
Posted on the from John S.
A. Remus
A. Remus
User
Autor

Great. i have some locations to test.(Not si many but i have). Also i can easy use some known positions vpn's to give a test also. Exactly i was visited from RO. Ok i will write on that post if is accurate or no. Thank you again.

Czytaj więcej
Posted on the from A. Remus
Adrian B.
Adrian B.
User

Also try Microsoft Clarity - which shows you where on the page your visitor moused to...

Czytaj więcej
Posted on the from Adrian B.
A. Remus
A. Remus
User
Autor

I figured out. Actualy is not so complicated for who know some html and php. Is not the best way but for me it was worked just fine and now i recive a email evry time a particular page is hit and i know what page is since i was setup a page_id.

Czytaj więcej
Posted on the from A. Remus