How to count Unique Website Visitor by Laravel 5.7? - laravel-5.7

Recently I'm developing a Restaurant Website Dashboard. They want to track the total unique number of visitors to their website. Now how can I solve this problem...? Can anyone please describe how to count the Visitor Number through Laravel...?

One way would be to fetch the user's ip address and then through ajax update the database and add one record in the database with that ip, then for any other updates to that table, you will first check if that particular ip already exists in the table and if it does, you wouldn't insert a new row. This could be a problem with people with dynamic url, but this should be an easy and quick implementation and it's not Laravel specific, so you could do it on every page load you fetch the ip, send it to your backend, save it and you are done

Related

How does WooCommerce get a user's country

Ok so I know that to get the current user's location in WooCommerce you use
$woocommerce->customer->get_country( );
Woocommerce then returns the user's country as a 2 character user code i.e (GB,US,MX) My question is, where is WooCommerce getting this value? even when I am logged out it seems to get the correct location. Is this some kind of Geo coding or it uses a cookie or database to return a user inputed value?
It is using MaxMind API, class WC_Geolocation located inside includes folder.
The MaxMind GeoLite Database will be periodically downloaded to your wp-content directory if you check to use geolocation, there is option in settings.
You can find talk when they added it to WooCommerce here: https://github.com/woothemes/woocommerce/issues/6969
Never used WooCommerce before but in the past I have used GeoIP to get a users country and other information based on IP address. It's not always accurate though (country is likely to be accurate but city isn't)

How do I track repeated users that visit my website?

How do I do that since almost everyone uses dynamic IP?
It changes everytime the users connect to the internet...
I wanna know if an user visited my site yesterday and today. How do I do that?
Integrate an analytics library like mixpanel and create javascript events to keep track of your users new or returning. That will be a better approach.

detect email view counter using ASP.NET

I'm creating a newsletter dynamically in my ASP.NET web app. I've made an ASP.NET page which is sent my users via email, I need to know how many times this email is viewed, what are my options? I have another page which acts as an archive for my newsletters, so I should find a way that each time my email is viewed, "numview" column in my newsletter table is increased by one, is it possible? are there any ready made tools or I should make one using code? it is easy to make one but my page is going to be viewed as an EMAIL, so I think I cannot write SQL commands, how can I solve this problem?
It will not be very easy to add tracking to normal email. but if you are loading some external webpage(of yours), inside the email (via an iframe or as an images source or so), you may try any of the following.
You can try incorporating some analytics code inside your page. So everytime when someone visits the page,the visits will be tracked. You will get a clear picture from the dashboard of the analytics provider. There are lot of providers but i think google analytics is the winner. It is free as well.
If you want to implement your own, you can have a one table which stores the pageid/url, users' IP Address, date, browser etc.. and add a record to this table on the page load event of your page.
I've made an ASP.NET page which is sent my users via email
I had a little trouble understanding this. If it's an ASP.NET page, then how can you send it to users?
Forgetting about ASP.NET for a minute, you can just send an HTML email. One trick is to have the email reference an image on your server. You could then write ASP.NET code to intercept that server request and count the number of times that happens.
However, this is not reliable because most email readers will not display images unless the user indicates images should be loaded for an email because spammers have used this technique too many times.
So, to the extend I understand the question, I do not believe there is a reliable way to accomplish this.

Separate analytics for each profile page within a single website

There are multiple profiles on my website and each user is managing his/her profile himself. I am trying to find the most efficient way to present analytics of each profile to its owner. Here are 3 ways I found:
Record each and every hit made on a profile page against that profile. This is not just count of hits, this requires to record IP, country, referrer, search terms etc. against each hit. This would require me to manage a huge database as there would be a lot of hits on each page. And a lots of processing on this database. Even if I have to de this, what database is recommended for such use?
Use Google Analytics on each page. But I am not sure that Google Analytics provide an API to fetch Analytics for individual pages.
Use some open source solution like piwik. Again I'm not sure if they provide per page analytics or not.
Please suggest the pros and cons of using each approach.
Update: More explanation - Think of it like a facebook page where each user can see hits on his page. What solution you'd suggest?
For Piwik, you can create a site id for each user, because you are allowed unlimited site ids with Piwik. You can can use a tracker with that user siteid, so when your member logs in, they get data only on their pages. You might also want to look at using custom variables and use the Piwik API to filter data.
Check here for info on multi-tracker: http://piwik.org/docs/javascript-tracking/#toc-multiple-piwik-trackers

google analytics - allowed domains

My GA tracking code is being referenced on another persons website. I am currently tracking several domains/sub-domains in one profile. Is there a way to create a list of allowed domains for reporting and data collection purposes?
Go in to Google Analytics, at the bottom click on Filter Manager. Add a new filter, with the type "Exclude all traffic from a domain" and enter the other person's domain name. Select your website profile and save.
Could be they have a similar account number and haven't realized that they are using yours instead. Boy, hope they're not getting paid for analytics by a client. That would be most embarrassing. :)
You can setup an Include filter instead of an Exclude filter.
Create a regexp with all the domain and sub domain names on which you run your UA number :
^www.domain1.com|^www.domain2.com$
This way you are sure to only get your data.
If you use e-Commerce transactions, they cannot be filtered out by hostname: you need to setup a filter on the transaction ID, matching the format of your transaction IDs.

Resources