Track Page Visit

  • geeksscript
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1

geeksscript created the topic: Track Page Visit

Hello,

My form has 2 pages. I want to run a PHP code when the user visits 2nd page. This PHP code captures IP address of the user & sends an email to admin mentioning "user with IP has visited 2d page".

We need this to understand the number of users who are leaving the website without completing form submission.

Please let me know. You may also suggest anything for this purpose.

Regards,
Sanchit
#236152
  • Posts: 5896
  • Karma: 118
  • Thank you received: 544

MarioPuco replied the topic: Track Page Visit

Hello there,

Please take a look at this article on how to add Gooogle Tracking Code to your 2nd ( thank you ) page crosstec.org/en/support/online-documenta...ogle-analyticys.html

I'm sure this is the way if you want to add anything other than GTC too.

Let me know if you need anything else.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#236157
  • geeksscript
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1

geeksscript replied the topic: Track Page Visit

Thanks. I would like to inject the code in form itself. How can I check if the page is 2nd and not 1st or 3rd?

Please let me know.
#236158
  • Posts: 5896
  • Karma: 118
  • Thank you received: 544

MarioPuco replied the topic: Track Page Visit

Hi,

It would be injected to this particular form if you added it that way as the article desribes.
Not sure how you envisioned this but you can use BF predifined script ff_currentpage to check what page you are on.



Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#236160
Attachments:
  • geeksscript
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 1

geeksscript replied the topic: Track Page Visit

I tried adding below code in before form > custom but it does not seem working:
if('ff_currentpage' == 2) {
function getUserIP(){
$clientIp = @$_SERVER['HTTP_CLIENT_IP'];
$forwardIp = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remoteIp = $_SERVER['REMOTE_ADDR'];

if(filter_var($clientIp, FILTER_VALIDATE_IP))
{
$ip = $clientIp;
}
elseif(filter_var($forwardIp, FILTER_VALIDATE_IP))
{
$ip = $forwardIp;
}
else
{
$ip = $remoteIp;
}

return $ip;
}
$user_ip = getUserIP();

mail ('xyz@xyz.xyz', 'User on 2nd Page', $user_ip);
}

Please guide.
#236170
  • Posts: 5896
  • Karma: 118
  • Thank you received: 544

MarioPuco replied the topic: Track Page Visit

Hi,

Please try this :
if( intval($_REQUEST['ff_record_id']) > 0) {
    $user_ip = getUserIP();

    $this->sendmail('email@mail.com', 'mario', 'mario.puco@crosstec.org', 'google tracking', $user_ip . ' just submitted form');
}

function getUserIP(){
    $clientIp = @$_SERVER['HTTP_CLIENT_IP'];
    $forwardIp = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    $remoteIp = $_SERVER['REMOTE_ADDR'];
    
    if(filter_var($clientIp, FILTER_VALIDATE_IP)) {
        $ip = $clientIp;
    } elseif(filter_var($forwardIp, FILTER_VALIDATE_IP)) {
        $ip = $forwardIp;
    } else {
        $ip = $remoteIp;
    }
    
    return $ip;
}

Just bare in mind that sendMail has the following paramters order :

$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment); 

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#236186
Moderators: ForumSupporttomeperica
Time to create page: 0.119 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here