Tracking purchase of particular product on different sites

倾然丶 夕夏残阳落幕 提交于 2020-01-03 14:00:48

问题


I have a website on which other websites owner can list their products. For listing the product they need to manually create the product by providing title, description, image and link of products.

When any user will visit my website he will be able to view these products and on click of any product he will be redirected to the owner's website and purchase will be done on his website.

Now I need to build a functionality by which I can track the complete transaction of the sale of that particular product, that particular product has been sold or not.

  • Whenever any site owner is coming on my site to list his product he needs to first register on my site.
  • After registration, I can provide him a chunk of a script that he needs to put on his site header.
  • Apart from this, I cannot modify his site. And I just need to track the particular product's transaction.

I have searched and found that Trivago and Skyscanner are using something like this.

I have tried to create some scripts in JS but couldn't track the desired things, as sometime user does not purchase my item and I did not know about this. In some sites, thank you page does not have enough information about the sale to capture.

If that can be possible just by adding few more things on Marchent's website please let me know.


回答1:


To make sure that your Postback works on all platforms and providers, you must provide more than one way to your merchants to implement on their websites.

  • JS script ( you already done that )
  • Server to server implementation (S2S callback) - where you send the order id in the headers or get parameters, and the merchant must provide it back.

Example: you send your traffic as below format: http://merchant_url.com/?tracking_id = 123123123

The merchant returns back when a purchase is made to your tracking url:

http://your_tracking_url/?merchant_id=1&tracking_id=123123123

This way you can identify your traffic

  • 1px iframes, that load on their thank you page and they pass the click order_id parameters

Example: your merchant should place something like the below on their thank you page:

    <iframe src="http://your_tracking_url_iframe/tracking_id=123123123"
    style="height:1px;width:1px"/>
  • lastly, even 1px image elements are usually also used in such cases.

Example:

    <img src="http://your_tracking_url_img/?tracking_id=123123123" style="height:1px;width:1px"/>

This way, even if merchant is using simple html/js on their thank you page they can always load your iframe with the specified parameters which will help you track a sale.

Hope this helped.




回答2:


You can use cookies for an easy implementation.

Because the end client need to come from your website he should have your cookie with a userId and a productId before he goes to an other website.

On the thank you page of the other website there should be a call to your server (usually a 1px image). Server side you will have the same cookie and the website as referer.

Then you can say to the website how many clients bough after clicking on a product on your service. (Be sure to count sells only once per user!)

If the website want a cross validation they can provide you with the IDs of products bough when they call so you count only when the IDs match.




回答3:


This is complicated, not because of the technology involved, but because of the variety of commerce solutions out there and the open-ended nature of human choice involved.

It sounds like you have secured two vital components to make this work: the ability to identify registered merchants and the ability to place a script on their webpage.

There is a third component you need, I think; either an agreed upon interface for that script (once a commercial transaction is completed or failed, hand the object with statuses back to your script through a specific triggered event) or full knowledge of the events for the merchant's website that you can code to.

Coding for the unknown will require a lot of time and effort as you would need to learn each merchant transaction solution and how to capture the transaction data. This will be... a long haul and I don't think it would be very successful.

If the merchant site is willing, they can trigger an event that your script will be listening for and pass along the transaction data to it, which would allow your script to pass along via AJAX to a waiting tracking page to record the results. This is simplest in terms of reaching an agreement and for the work involved, from your indicated starting point. jQuery is an excellent library for wiring this all up and there are other options.

Part of tracking would be passing along a token that ought to be carried through the transaction and passed back, generated by your site on the click to said merchant's website and passed on from there. Once you get your token back, you can compare it to a database of transaction tokens to find out which event had what result and fill in the appropriate fields from the resulting data.



来源:https://stackoverflow.com/questions/49008461/tracking-purchase-of-particular-product-on-different-sites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!