Question

I need to make something like google-analytics, I mean that it has to be very simple to install and enables a comunication between 2 websites. Let me explain the idea.

I'm developping an application (with ZF) where my clients will be online shops, OSCommerce only at the begining. Those shops need to get some info from my app's database, send me some info and propose to their clients to use my app's service. What does the code needs to do:

  • if there is a certain $_GET param in the URL (that indicates that the user is coming from my site) -> starts a session in the shop and send me some info for my stats (IP, browser info, etc...)
    • if this user buys something during this sesion -> send me some info about the sale (total, id, ...)
  • during the checkout process (checkout-payment.php in OSC) give the possibility to the user (the shop's client who is also a member of my application) to insert his email+password from his my-application's account in order to get a discount in the order he's placing.

I know how to program all this, editing the shop's files, but my problem is that I have no idea about how to make it in the google-analytics way (give a small javascript to my customers to install in their store) and neither what to look for in google in order to find the information I need.

So, can anyone helps me to get in the right path? Thanks in advance

Was it helpful?

Solution

Since you'll be needing to go cross-domain with this utility, you'll want to write your javascript piece for inclusion using JSONP. Your JSONP "call" could simply be made to some PHP script on your server by tacking on information obtained from window.location (like the query string, for example).

OTHER TIPS

Maybe all you need is to give your customer an URL pointing to your js library? And than your library can work or better provide them with API to your service to get customer data etc.? And yes - JSONP can help you with inter-domain comunication...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top