Combining JS and PHP

Has anyone come across any best practices for combining JS and PHP Curl calls? It’s absolutely essential for us that every user has a VisitorID, as we’re using it for purchase tracking

This is our current workflow

  • If no cookie
    Perform a PHP call to track the page and return the Visitor ID, store in session + cookie

  • If cookie
    Display the JS only, setVisitorID from the cookie. VisitorID stored in session

This method ensures that for every unique visitor, there is always going to be a VisitorID available to server side PHP, even if only one page view is registered.

I’d be interested in learning more about combining JS and Curl tracking together, as we’d like to have the javascript functionality available at all time. Any thoughts or other approaches?


There is some discussion about this here

but nothing specific is planned and I am not sure if doing this is even possible in a way that works reliably and has a focus on privacy.

1 Like

Thanks Lukas, that link has given me a few avenues to research - specifically the server logs