How to track a particular page without using google anlytics? - reactjs

I am working in an application where a product detail page need to be tracked without using google analytics.I have a scenario where a product is trending or not.To achieve that I need to get the views of that page.A Product which is having more number of views is considered as a trending.This trending may change in day-to-day life.
Done some research https://github.com/nytimes/react-tracking
But didn't get any perfect solution.Need help to add this functionality.

Related

Can we use Gatsby js to build a simple social networking website

I need to develop a simple social networking website which will just act as a platform for different businesses to discover each other. Each Business man/Service provider will have his own profile that he can manage and these profiles will be characterised and sorted according to their types. Basically I would need a Home Page, Profile page for each profile, Search page along with registration and login. I don't need to make any messaging module.
So for this purpose I wanted to know if using Gatsbyjs is a good idea, also if not then what are the other frameworks that I can use for a easier and faster development.
One main problem with gatsby for this use case is: Once a new business signs in and wants to create and edit a new profile, this new profile is not part of the build process. Gatsby builds only the HTML pages you know in advance. Triggering a rebuild, which may take several minutes, everytime a business edits their page is not feasible. You would have to hack something together with client-side routes which is not the intended nor recommended way of doing things.
A server-side framework like Next.js is better suited for this task. This way you can dynamically add and change the profile pages.

Loading the Market Price for ETH-USD using Coinbase-Pro-Trading-Toolkit

I am using the Coinbase-Pro-Trading-Toolkit (Coinbase Pro API)
There are several ways to get the market price using the toolkit. I am not trying to run a live feed, I simply want to use the API, so I'm looking at a couple different methods:
publicClient.getProductTicker(product)
coinbasePro.loadMidMarketPrice(product)
Both of these work great when I pass in a product of "BTC-USD". But when I try passing in "ETH-USD" it fails. Are these methods designed to work with certain products?
Okay I feel silly with this one. The issue was that I was using the sandbox api and not all products appear in the Sandbox API. Only API calls to Coinbase Pro’s production site will produce a full result set.
Good news is that all products have same attributes and therefore testing in the Sandbox is possible.

How to properly construct and use API to feed different sections on a web page for data they require?

I am working on an article listing website. The site home page has 3 sections. On top it displays a slider/carousel with 3 slides followed by an article list with 6 items and a "Load more" button (to load next set of articles). After the list, there are 2 sections displaying spotlight or featured articles. The front-end uses react and each of this section is a component.
For back-end it uses REST API (Node + Mongodb). I can fetch all articles calling an API endpoint but i want to know how those 3 sections on the home page should consume it? Should i create and use separate API calls for each of the section? What would be the best way? Please help.
In general i feel splitting each component responsibilities and have them handle their own calls is the best way to go, the code is clearer, easier to maintain and more scaleable.
However one thing to keep in mind is the expected network latency for your users.
In a high-latency situation with otherwise good bandwidth, many small requests will perform significantly worse than one large one.
You should also question when (if) you send one large response is all/most data available from it used? Or is most of it wasted on a state most users wont even reach?

AngularJS - Shop list best practice

I'm new to AngularJS, and i'm want to know what's the best and easiest practices to do this simple shop list application.
So this is my shop:
I got three servers in my select input. Each server got own list of items, displayed in another component.
I'm thinking about creating routes with variables like localhost:4200/shop/{server1} which gonna show my list of items based on url path. Select option will just change path in my application to show shop list for specific server.
Is it a good practice, or there is better and easier solution to implement this simple shop application?
If you're asking if filtering data with routing is a good practice with Angular, I can say that it is not a bad one. Here's a link to the official Angular documentation about routing : Angular - Routing
But if you're asking if it is the only way to filter data or spread parameters, the answer is clearly no. Angular projects are SPA (Single Page Application), so you can do everything without touching the url.
For a quick example, you can attach a (click) event on your elements that display the shop list you want
I think you can use just one component and three different click events to display three different results. One component can work in your case. Using a router and routing logic for your requirement will be a costly affair. Your user will have a better application feel if these are covered in just one component and with three different click events.

How big online shops store product pages

just a question from curiosity. How big online stores with lots of products (can) store their product pages?
I know one solution might be database and then generating the content on demand, but how would they be able to hand URL requests like www.onlinestore.com/productname.htm? (Specificaly I mean this store http://www.alza.cz/pevne-disky/18842851.htm ). Every product links to productname.htm page.
Is it possible (and viable) to have all product pages pregenerated?
The answer will vary from vendor to vendor, but typically this is achieved with a combination of custom URL routing, and a server-side, database-driven language like ASP.NET or PHP.
In the case of your example, it is likely that the "18842851" of http://www.alza.cz/pevne-disky/18842851.htm is actually a product Id, and their server is parsing that product Id in order to get the correct product content from a database. With the content in-hand, the server can then return a reusable template.

Resources