6

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.

Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
Anshul Mishra
  • 1,706
  • 2
  • 15
  • 38
  • 1
    What exactly is your question that can be addressed with a detailed canonical answer? – jornare Mar 14 '18 at 12:26
  • My question is just how can we track that sale has been done or not with a specific product on a cross domain. It seems like a common functionality that is in use by lots of business nowadays. – Anshul Mishra Mar 14 '18 at 12:30
  • so you can add hook like order_complete for every php eCommerce platform – Vishnu Bhadoriya Mar 14 '18 at 12:33
  • The eCommerce is not mine, that is a kind of client for me and we can not sure about the technology of client's website. – Anshul Mishra Mar 14 '18 at 12:34
  • 2
    so you must need to create plugin / extension for particular platform – Vishnu Bhadoriya Mar 14 '18 at 12:35
  • 1
    Most services of this kind provide server-side modules/plugins for integration into the major shop systems. Of course you can try and do this using client-side scripting only - but then you would still need to find a way to parse the relevant data from the respective shop pages, the structure of those is also likely to largely differ, not only between shopping systems, but maybe even between different templates for one and the same system. – CBroe Mar 14 '18 at 12:45
  • @VishnuBhadoriya I understand this that I need to create some script/plugin for this. I have created a script as well that I provide to the merchant so that I can track user has been reached to the merchant site and for which product he has reached there. Now I just stuck that how I can track after payment that the particular product has been sold or not. – Anshul Mishra Mar 14 '18 at 13:26
  • @AnshulMishra I am stuck in a same situation. Can you please help me how did you resolve this and did the solution work for you. Please reply me I am really stuck in the same situation. – Eatsam ul haq Jan 11 '22 at 15:19
  • @Eatsamulhaq I had used https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API. – Anshul Mishra May 09 '22 at 06:33

3 Answers3

3

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.

nitrex
  • 522
  • 6
  • 16
  • Thanks for your answer, but I did not get 1px iframe or 1px element. Can you please explain this a bit or provide me any ref from where I can read about this. Although I am looking into the S2S callback now, this may helps me – Anshul Mishra Mar 19 '18 at 06:15
  • Edited my answer so you understand the approach in each case, let me know if you need more assistance – nitrex Mar 19 '18 at 09:50
  • Thanks for your explained answer, just one question how we will track that particular product has been purchased or not with this technique? – Anshul Mishra Mar 19 '18 at 10:16
  • @AnshulMishra how we usually do it, before redirecting from your website to the merchant, you create a token and save it in your db linking it to that product, and then when the merchant returns that token you will identify a) the user that bought the product b) the product that was bought c) any other details you need. – nitrex Mar 19 '18 at 16:53
  • Thanks for your answer. It does not match my requirement 100%, although it gave me an idea that how can I proceed now. Once I will complete this I will post the solution as the answer here. – Anshul Mishra Mar 21 '18 at 12:29
  • Glad my answer was helpful – nitrex Mar 21 '18 at 13:47
0

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.

GuySake
  • 124
  • 1
  • 6
  • Yes but cookies don't serve with S2S integrations... and a simple token would cut it. Usually cookies are used in a different more complicated context for his usage. – nitrex Mar 19 '18 at 18:30
0

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.

Malovich
  • 931
  • 1
  • 5
  • 15