Tracking clicks on Telegam inline keyboard buttons - telegram

We are using telegram bot to post advertisiment messages in channels. Ad message always has a text and inline keyboard button in reply markup. This button is a link to promoted resource. We want to track button clicks but there is a problem. As described here, button must contain exactly one of optional parameters - it means, that there will be no callback query if we use url for button. So, the qustion is - is there any cheating way to track clicks and keep button being link?
Current metod is adding layer on our server. Button is moving to our page on server, that redirects to final url. But it is very bad - often link is other telegram channel link and user's browser is opened, when there' is no need.

You need any shorten URL service like botanio for example.
Shorten url
Send GET request to
https://api.botan.io/s/?token={token}&url={original_url}&user_ids={user_id}
You get shortened url in a plain-text response (in case the response
code was 200). Codes other than 200 mean that an error occurred.
Also, in case of group chats you can add several user_ids:
&user_ids={user_id_1},{user_id_2},{user_id_3}, but currently this data
will not be used (because we don't know which particular user clicked
link).
Start chat with Botan in Telegram for getting token wich required in GET request and follow bot's recomendations. It can be helpful not only for URL track but for any click also.
Note that this service has problems in Russia as we can see from this issue. May be not in Russia only.
As the alternative you also may use Google URL Shortener, Bitly or many others.

Related

Close the Browser when click on a button

I have a project to order online and when the client finishes ordering I want to add a button to close the browser and return to WhatsApp messages where start ordering how can I close the browser when the client clicks not only one tap?
how can I close the browser when the client clicks not only one tap?
My guess is want to add a link to your website that sends the user back to your Whatsapp page. This does not involve manually closing a browser. Instead, you need to add a link to your webpage.
For example:
https://api.whatsapp.com/send?phone=18005551212&text=Hi!%20I%20want%20to%20increase%20my%20sales!
When clicked, this will send the user back to Whatsapp phone number 1-800-555-1212. You will need to change this to your phone number.
For additional information, Whatsapp instructions can be found at:
https://blog.wearedrew.co/en/3-steps-to-integrate-whatsapp-with-your-website

How to view the address of the POST request made when an HTML button is clicked?

I am creating a project involving web scraping and web automation. I would like to first submit this form (http://rgsntl.rgs.cuhk.edu.hk/rws_prd_applx2/Public/tt_dsp_timetable.aspx) then once you submit this form, I want to scrape the HTML page that comes up. The problem is I am not sure how to submit this form through a Go program.
I was previously experimenting with Selenium to emulate a web browser but now I think there may be an easier way. I think that I should be able to make a POST request to the same address that the "submit" button of this form makes to and directly use the HTML page that is returned. The problem is that I cannot figure out how to get the address that the submit button makes a POST request to. I would like to ask if there is a way to monitor the address that the button makes a POST request to when it is clicked? Also if you see any flaws with my idea please do let me know. Thank you.
Right click mouse and select inspect option. After that select the Network tab.
When you fill all the entries and click submit button many urls flashes. Select the top url and under the headers tab you will see the request url for POST method.
See the image

Difference between "Reload this page" and refresh a page from address bar

I'm working on an asp.net web app. One of my web page received a posted value from a remote server:
HiddenField1.Value = Request.Form.Get("something")
And further on I'm using javascript to manipulate value from this HiddenField1.
The weird thing's that if I clicked on the "reload this page" icon on any browser:
reload page icon
page's reloaded and HiddenField's value's there
However if I moved mouse to the address area and clicked on the url,
address area examplethe url string's background turned blue and I hit Enter key,looked like the page's behavior's exactly the same: reloaded. However, the HiddenField's value's gone.
Any hint what's the difference between the two scenario?
This is not strictly related to ASP.Net: it is actually a common browser behavior and you would experience the same with a different server language (php, python or whatever).
In your second scenario, the browser will send a new (GET) request to the server, asking for the last loaded URL. It would be the same if you just type the address starting from a blank Address area.
In the first case instead, you are telling your browser "please, repeat the last request you made". Maybe it was a POST request sending data (form fields) to the server, and the server did answer to the previous request inserting the hidden field you are noticing.
To recap, the second scenario is "send a GET request for this address, ignore everything else". The first is "Repeat the last request you send. If it was a POST request with form data, send it again as the time before"
Very likely in your case, the server code inserts the hidden field just in case of a particular POST request (possibly according to posted data), and not for a GET request
If you don't know the difference between POST and GET for an HTTP request, this answer can be helpful

Tracking actions like selecting a checkbox

I have some check boxes on my website selecting which the data on the page gets filtered but the page name remains the same. I want to capture the data for visitors selecting any of the check boxes. Can you please let me know how can this be done?
Presently, I have different page name whenever the user select any of the check box. But by doing this, Page views data for that page becomes irrelevant.
For Omniture tracking, that's very possible, but you need to add a bit of javascript. You need to add an onClick event for the checkbox, and have it submit a custom link event to Adobe. They provide a function for it:
s.tl(this, 'o', 'Checkbox X Clicked');
Prior to this call, you can set props/evars if you want other tracking tied to this event. It doesn't count as a page view, though.
The Omniture implementation guide is here:
http://microsite.omniture.com/t2/help/en_US/sc/implement/oms_sc_implement.pdf... do a search for the s.tl() function. It'll explain.
Presumably, your page has JavaScript that does the filtering.
You would need to add to this JavaScript to send an AJAX request to the server every time the user makes their selection. The server will need to track the requests in a database or a file. After that, you can analyse the results.
There are many ways to send AJAX requests in JavaScript. The basics are here: http://www.w3schools.com/ajax/default.asp but there are also 3rd party libraries available.
Unfortunately there is nothing that "google-analytics' can do for you here, as far as I know.
Good luck,
DC

Back Button History: Skipping Page After POST

Move backward through history skipping the same page with different query string
The above is similar to my question, but I'll be more specific as mine concerns POSTs:
Scenario:
User is on Product Listing page. (Shorts.aspx)
User picks a product and navigates to product detail page (Best-Cargo-Shorts.aspx)
User clicks add to cart which performs postback (POST) of form to same page. (Best-Cargo-Shorts.aspx) -- this now shows Details page again, but with an Added TO Cart message at the top.
Current Behavior:
After the Add TO Cart form post; when the user clicks the Back button they navigate back to the "pre-post" version of the same page.
Desire:
When a user clicks the BACK button, I'd like it to go to Shorts.aspx, NOT Best-Cargo-Shorts.aspx, effectively Skipping the "pre-POST" page, or more accurately NOT STORING the 2nd POSTed page (Best-Cargo-Shorts.aspx).
Furthermore, I always want to avoid that "Page Content Expired" message. I just never want the POSTed version of the page in history. In this way, the following could also be true.
Shorts.aspx > Best-Cargo-Shorts.aspx > Best-Cargo-Shorts.aspx [POST] > Cart.aspx
If on cart and BACK button is pressed, I want the browser to navigate to Best-Cargo-Shorts.aspx (without the POST).
Is this possible with C#? Furthermore, is there a non-javascript solution?
Thanks.
One common way of handling this is the Post-Redirect-Get pattern.
In essence, the target of a POST request always responds with a 303 See Other (if HTTP 1.1) or 302 Moved Temporarily (if HTTP 1.0) status code redirecting the request as a GET, and usually eliminating the expired POST page from history. Potential downsides include the form parameters possibly remaining attached to the GET as a query string, and I've no clue how well it would (or wouldn't) integrate with ASP.Net Forms, MVC, or other web frameworks.
Generally, you should be using the post-redirect-get pattern, i.e. after the user adds the item to the card using POST, redirect him to Best-Cargo-Shorts.aspx with 302.
Now to your question, I would use Ajax for the post. I cannot think of a cross-browser way to achieve the desired behaviour using only server side code.

Resources