Tracking purchase of particular product on different sites - javascript

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.

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.

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.

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.

Related

Are there any functions to return the logged-in user's name / role in Acumatica Customer Portal?

I'm working on customizing the landing page in our company's Acumatica Customer Portal by using a Wiki page, and I need to modify the displayed HTML elements based on the user's role, as well as write the user's name into one of the HTML elements.
What I'm trying to find, is a way to make an Acumatica function call maybe using Javascript, that returns the user's name and role, or maybe an API call I could make to get the same information.
What I've found / tried
I found that there's a function that returns the user name in this post, and I've tried to find ways to run it from Javascript, when the landing page loads, but haven't been able to make it work.
I also found that I can make API calls to Acumatica, and it gives a lot of options to retrieve production related data, but apparently none of the available endpoints directs to the current user's profile (which is screen SP408045 in the portal).
Thanks in advance for your help
There can be multiple users logged in at the same time.
System Monitor page lists logged in users:
An API call couldn't figure out which user you want.
With JavaScript you can try Cross Site scripting and parse the HTML element to find the logged-in user and roles. On Acumatica side the editor control values can be read with px_alls global javascript object. In both cases the logged-in user information must be present in the page. This means the pages have to be customized to add those elements. They can be hidden from UI but must be present in HTML source.

How would you advise managing likes/unlikes on an activity object?

For example, if I were to build an application similar to Instagram where each post displays the number of likes for each activity.
What streams would I need to create?
What would the network calls look like for liking and unliking an activity?
Where would I get the number of likes associated with each post?
Can I do this all on stream, or would I need to rely on another backend?
There are two approaches you can take. One updates the original activity with a counter, another uses our analytics.
When you add an activity, if you send us a foreign id and timestamp, you can use that foreign id later to update the activity. Then, in the metadata of the activity you can have a field to count the likes and each like/unlike would update the activity. If you look at the Instragram-clone project I built in late 2016 you'll see an example of this in the Go backend code. The pros/cons of this approach: easy to manage yourself, but you need to send the entire activity as it was (same timestamp, and all other fields as you originally sent it) so you'll need to keep the data on your side as well. Also, if a user follows the feed where that activity is stored, they may not see the updated content as a new activity in the feed.
The feeds you'll need: https://getstream.io/blog/best-practices-for-instagram-style-feeds/
Backend code: https://getstream.io/blog/example-go-service-for-photo-sharing-app/
The second approach uses our analytics properties that can track this kind of metadata field in a different way, but the down side is that it's only available on our enterprise plans. You can look at our documentation page for information on how to use this.
Introduction: https://getstream.io/analytics/
Documentation: https://getstream.io/docs_analytics/#introduction

How to submit a form internally?

I am curious about submitting a form data internally.
Here is an example.
I want to register an account for a website. The website will give a form to register which upon submitting will create an account for me.
But I don't want to go to that site. Instead I'll give a form in my style and collect the same information. Upon submit, I want to create the account automatically. Automatically in the sense, I'll submit the form internally.
The reason why I need this feature is, I don't want my users to create a separate account in another website also. I mean it should save user's time in creating account only. Rest of the things will be taken care by me.
Please let me know if anyone had tried this and had success.
I know it is very difficult for existing accounts and some internal errors. But I also need to track them.
Please let know if this is possible or not.
An Example
There is site called othersite.com which has a form for creating / registering users.
I will a similar form to the user on mysite.com. But upon submit the form information is sent to both mysite.com and othersite.com. Both sites create accounts parallelly with a single form submission.
Unless you are working with AJAX requests and CORS enabled sites, which I assume is not the case, client side technologies ( browser/javascript ) will not help you much to do that.
You have to ask yourself what are the options to integrate with the second site in order to automatically create the account. Following some common patterns used these days:
REST API: You have an url where you can use HTTP to talk to and ask to create the account. Many social networks and other popular services usually expose it. Facebook API
Database: Although it is less recommended you could just insert a new record into the account table if you own and have access to the database used by the second site.
Client Libraries: Some sites provide client libraries so that you can use them together with your project code base. Eg: Twitter Libraries

limit access to webpage by login with a list of generated unique ids

I am building a voting kiosk (iPad that is present in the exhibition space) that will be used to vote for projects taking part in an exhibition in a museum. I am using Typeform (http://www.typeform.com/) to generate the voting form. That's all working perfect. The only issue is that I need to limit the voting to one vote per person. I thought that asking for an email address in the beginning of the form would do the trick, but that's far from perfect. People have more than one address, and since there is no real way of validating the address, also things like something#gmail.com will fool the system. So I thought to add a login page before the form. Visitors will get a unique code when buying the ticket to the exhibition and with this code they can log in once to go through the voting process. The fact that all votes come from the same IP/source rules out any IP based solutions.
How can I go about building this login page? I am quite comfortable with PHP and JavaScript, but I need a start here on coding a login form that will accept only codes from a generated list of unique codes (and generating this list as well).
If you a better idea altogether, I'm open for suggestions!
Thanks, Ehud.
Try using the MySQL DB. You could collect the IP's (One Account per IP), also you can set a User ID with is unique. So, if someone votes, the DB collects an requests If the user already set a vote.

count page hits that come from emails using query string

We send follow up emails for inquiries on our products and I wanted to track how effective they are.
This is my plan:
Update the url in the hyperlink of the email to include a query string like:
href=http://www.somepage.htm?source=fromEmail
And then track how many visits I get with the query string = fromEmail
My problem is that the page is a .htm and I didn't really want to rewrite it so I'm looking for a javascript counter that can accomodate the query string. Ideally I would like to be able to track the total page hits, as well as the hits that come specifically from these emails. Even more ideally I would like be able to track various information in SQL Server so that the person that requested this could do some reporting on it.
Am I going about this the right way or should I just rewrite it in .net (as we are a .net shop)?
While it is definitely possible to put some javascript on your .htm page that fires an AJAX request that increments a SQL counter table if the source=fromEmail, I would say that it is more reliable to have the server increment this counter when serving up the page.
Having the server do the work when the hit originally comes in will also allow you to track more specific information about the request for the report.
Javascript on emails is a no-no. Outlook by default blocks Javascript, so there goes 50% of your users. Other email systems are not keen on running javascript either. Remember, when you're doing HTML emails, you need to think 1995-vintage HTML. Thanks, Microsoft.
You've got a few (ok, but not great) options:
Include an image file on it. When it gets loaded, count it as a hit. This is how all the major services handle email tracking, with a 1px X 1px white image file that they most often place at the bottom of the page. The obvious problem with doing this is that if they use Outlook's preview pane with images enabled, it counts as a hit that they may not have read. If they read it on Gmail while not unblocking images (set to hidden by default) you've got a real hit that doesn't get recorded. So, either way, your numbers are wrong.
Track link clicks by routing links through your server. You use your server to then re-write urls for the browser to follow. Again, it works well enough, but won't capture the real numbers because only a small percentage of people who get an email actually click a link on them. Here's an example using link tagging with Google Analytics
A combination of the two above. It covers both cases, yes, but could result in double counting one user. You could also hybridize the two by setting a variable on each image that could track back to the source email, then store hits in a DB to eliminate dupes. That's a LOT of work, though.
My company sends (and tracks) thousands of emails daily as part of its core business, and we always encourage clients to do emails with "teasers" that draw them into other websites for the main content. Why? The closer we get a user to the main site, the closer we are to a sale--nobody has ever done an ecommerce transaction solely on email yet (that I know of) Also, it's one heck of a lot easier and offers far more options to do tracking via Google Analytics on a site than it is to track emails. Since you can't reliably embed Analytics in emails, your best bet is to get 'em to a website that can.

Categories

Resources