cancel
Showing results for 
Search instead for 
Did you mean: 

How to track customer email

How to track customer email

I want to read customer email and ID for a tracking purpose. My script is as below.

 

<?php
$_email = '';
$_customer = Mage::getSingleton('customer/session')->getCustomer();
if($_customer->getEmail()){
    $_visitorId = $_customer->getId();
    $_email = $_customer->getEmail();

}else{
    $_visitor = Mage::getSingleton('core/session')->getVisitorData();
    $_visitorId = $_visitor['visitor_id'];

}
?>
<!-- Initialize RDK -->
<script type="text/javascript">
window.sfrdk('_setConfig', {
    visitorId: '<?php echo $_visitorId ?>',
    email: '<?php echo $_email ?>'
});
</script>

This tracks the customer email in my account page but does not track in the product detail/list pages

Any idea?

1 REPLY

Re: How to track customer email

@Siddiquee Make sure you are putting code into correct file, enable path hint(System >> Configuration >> Developers). However on product detail page customers might be logged Or not if open to surf site for all customers.

-
Magento Programmer | Was my answer helpful? You can accept it as a solution.