PHP runs on the server and JavaScript runs in the browser. You can't just mix them together like that.
What you need to do is do the redirect with JavaScript, and not PHP.
<script type='text/javascript'>
mixpanel.track('login: Login ', {'page name' : document.title, 'url' : window.location.pathname});
window.location = '<?=$domain_name?>/services.htm';
</script>
UPDATE: The redirect is triggering before mixpanel.track
is complete. You need to pass a function to the callback docs, so it runs once it's done.
<script type='text/javascript'>
mixpanel.track('login: Login ', {
'page name': document.title,
'url': window.location.pathname
}, function(){
window.location = '<?=$domain_name?>/services.htm';
});
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…