Send an email per visit

Hi -

I am working on a small project where we want to send out and email everytime there is a visit… Any update on if it’s possible and if so, where would i got about doing it?

Thank you,

Okay, i was able to make a little bit of my way through and have an email out everytime there is a visit… i place a simple php mail code in.

/PIWIK/core/tracker.php around line 209 function main.

I put in the code there and an email is going out… but now my problem is that the email is blank and the main function doesn’t have any data related to the user…

Any tips on something i can do here?

Looks like the function handle() line 81 in file PIWIK/core/Tracker/Visit.php handles the visit… but adding a mail function inside that function doesn’t let me send an email… I am not that good at PHP… but i may be doing something stupid as if the email is not supoose to be inside a private/public function or something like that… May be?

Okay,

i figures was the creating a new mail function and that’s why it was not working… Now, i am able to trigger an email using the handle function in file PIWIK/Core/Tracker/Visit.php… The only problem… all the possible/avliable objects in that fucntion… for instance $visitor… are protected and i can’t seem to acess the data at all…they seem to return the data as the folllowing Object.


Piwik\Tracker\Visitor::__set_state(array( 
   'visitorKnown' => true, 
   'request' =>  
  Piwik\Tracker\Request::__set_state(array( 
     'params' =>  
    array ( 
      'action_name' => '', 
      'idsite' => '1', 
      'rec' => '1', 
      'r' => '489206', 
      'h' => '12', 
      'm' => '25', 
      's' => '54', 
      'url' => '', 
      'urlref' => '', 
      '_id' => '8a877ccc74f01a3c', 
      '_idts' => '1414531240', 
      '_idvc' => '2', 
      '_idn' => '0', 
      '_refts' => '0', 
      '_viewts' => '1414538938', 
      'cs' => 'windows-1252', 
      'pdf' => '1', 
      'qt' => '0', 
      'realp' => '0', 
      'wma' => '1', 
      'dir' => '0', 
      'fla' => '1', 
      'java' => '1', 
      'gears' => '0', 
      'ag' => '0', 
      'cookie' => '1', 
      'res' => '1920x1080', 
      'gt_ms' => '382', 
    ), 
     'isAuthenticated' => false, 
     'tokenAuth' => NULL, 
     'timestamp' => 1414599957, 
  )), 
   'visitorInfo' =>  
  array ( 
    'location_ip' => '111', 
    'idvisitor' => '11', 
    'visit_last_action_time' => 1414599957, 
    'visit_first_action_time' => 1414599923, 
    'idvisit' => '2', 
    'user_id' => NULL, 
    'visit_exit_idaction_url' => 1, 
    'visit_exit_idaction_name' => '0', 
    'visitor_returning' => '1', 
    'visitor_days_since_first' => '1', 
    'visitor_days_since_order' => '0', 
    'visitor_count_visits' => '2', 
    'visit_goal_buyer' => '0', 
    'location_country' => 'us', 
    'location_region' => NULL, 
    'location_city' => NULL, 
    'location_latitude' => NULL, 
    'location_longitude' => NULL, 
    'referer_name' => '', 
    'referer_keyword' => '', 
    'referer_type' => '1', 
    'location_browser_lang' => 'en-us,en', 
    'visit_total_events' => '0', 
    'visit_total_time' => 35, 
    'visit_total_actions' => 'visit_total_actions + 1', 
    'visit_total_searches' => '0', 
    'time_spent_ref_action' => 34, 
  ), 
   'configId' => '', 
   'customVariables' =>  
  array ( 
  ), 
))  

Any tips on how i can extract it?

please consider commenting on the related feature request: Log Tracker events (goals, ecommerce, events, content interactions) to a generic logger (or message bus, chatbot) · Issue #6209 · matomo-org/matomo · GitHub