How to get from where the user is coming on the landing page?
-
16-10-2019 - |
سؤال
When a user comes to my website I want to figure out from where he/she came?
For example:
1. Google or other search engines
2. Direct type
3. in email promotions
Any suggestions will be appreciated.
المحلول
Use the referrer.
Mage::app()->getRequest()->getServer('HTTP_REFERER')
you can observe the general predispatch event to catch it. controller_action_predispatch
.
If there is no referrer then it's direct access.
If the referrer matches google
then it's from google (Duh!).
For e-mail promotions you can include in the urls a GET parameter for each email campain and match it in the same event.
لا تنتمي إلى magento.stackexchange