Rafael P Posted August 24, 2023 Share Posted August 24, 2023 Hi everyone! I just made a file using JS Script and added on ServerModule and saved the file inside my project. How can i call this file on my application in OnClick Event in a button? For example, this function has to be activated when a button is clicked. I already tried UniSession.AddJS(), but unfortunately was unsuccessfully. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 24, 2023 Share Posted August 24, 2023 Hello, 21 minutes ago, Rafael P said: I just made a file using JS Script and added on ServerModule and saved the file inside my project. How? Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 24, 2023 Author Share Posted August 24, 2023 8 minutes ago, Sherzod said: Hello, How? Hi Sherzod! So, i saved the js script file inside my deploy achieves from my project: Deploy/Application/JS/Google_script.js and submitted on ServerModule -> CustomFiles. Now i want to call this file when a button on my application is clicked. Thank you! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 24, 2023 Share Posted August 24, 2023 38 minutes ago, Rafael P said: i saved the js script file inside my deploy achieves from my project: Deploy/Application/JS/Google_script.js and submitted on ServerModule -> CustomFiles. If the file is located in the web directory, and after including it in CutomFiles, if the file contains a running script, then it will already run. Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 24, 2023 Author Share Posted August 24, 2023 4 minutes ago, Sherzod said: If the file is located in the web directory, and after including it in CutomFiles, if the file contains a running script, then it will already run. I think i will need to specify more details from my project. First, this script was provided by Google and all he have to do is capture many of people who access our website and register on it, so he can help us to know where we can put our efforts in publicity, gain access, etc... it's a Marketing tool. And the instructions is telling us to put this script right after user click on register or confirm button. But i can't see a easy way to implement this... it was supposed to be something trivial but it wasn't until now... Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 25, 2023 Author Share Posted August 25, 2023 On 8/24/2023 at 1:42 PM, Sherzod said: If the file is located in the web directory, and after including it in CutomFiles, if the file contains a running script, then it will already run. any idea? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 25, 2023 Share Posted August 25, 2023 On 8/24/2023 at 9:54 PM, Rafael P said: And the instructions is telling us to put this script right after user click on register or confirm button. Link? Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 26, 2023 Author Share Posted August 26, 2023 (edited) 2 hours ago, Sherzod said: It's from Google Tag. We have to put on Click Button event, so the script can capture. Any ideas? Sorry to bother you, anyway, thanks! Edited August 26, 2023 by Rafael P Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 26, 2023 Share Posted August 26, 2023 43 minutes ago, Rafael P said: Sorry to bother you No problem. Where is the instruction? Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 26, 2023 Author Share Posted August 26, 2023 44 minutes ago, Sherzod said: No problem. Where is the instruction? We had a online meeting with some people from Marketing of Google, and that was all they said. There is no documentation on how it should be done, it was just said during the conversation Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 26, 2023 Share Posted August 26, 2023 I don't know, usually google always provides extensive documentation on how to use their services. Perhaps there are people on the forum who know what it is about. Quote Link to comment Share on other sites More sharing options...
mikromundo Posted August 26, 2023 Share Posted August 26, 2023 @Rafael P O que o Sherzod está lhe pedindo é que vc anexe o script js e poste aqui o link do Google onde vc o baixou. melhor ainda seria vc criar um projeto limpo, adicionar o script( pra simular o que vc quer ) que vc tem e enviar esse projeto. what Sherzod is asking is that you attach the js script and post here the Google link where you downloaded it. even better would be for you to create a clean project, add the script (to simulate what you want) that you have and send this project. Quote Link to comment Share on other sites More sharing options...
Rafael P Posted August 26, 2023 Author Share Posted August 26, 2023 1 hour ago, mikromundo said: @Rafael P O que o Sherzod está lhe pedindo é que vc anexe o script js e poste aqui o link do Google onde vc o baixou. melhor ainda seria vc criar um projeto limpo, adicionar o script( pra simular o que vc quer ) que vc tem e enviar esse projeto. what Sherzod is asking is that you attach the js script and post here the Google link where you downloaded it. even better would be for you to create a clean project, add the script (to simulate what you want) that you have and send this project. Opa amigo, então eu havia adicionado o link mas apaguei depois da resposta dele. É pra colocar esse script após o confirm do botão, só que não faço ideia de como colocá-lo porque é de uma ferramenta de analytics de marketing do Google. Nos foi dado durante uma reunião e chegou até mim somente dessa forma. Então não sei se isso é realmente possível. Quote Link to comment Share on other sites More sharing options...
Ron Posted August 27, 2023 Share Posted August 27, 2023 I guess you can store the script in a text file, load it into a stringlist as the application starts, and then run the script using AddJS when you need it, like in the event handler of a button. In mainForm.Create: sl:=TStringList.Create; sl.loadFromFile('myjs.js'); In onClick event handler: AddJS(sl.text); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.