trigger the url without visiting it

Mehr
4 Jahre 4 Monate her #93568 von agabriel
agabriel erstellte das Thema trigger the url without visiting it
Hi,

I have a survey that need to tract if they click the Facebook share button in the completed page.
- I used a url to solve this. But the problem is the user is navigating away from the completed page when they click the share button.

How can i trigger the url without visiting it?

I tried with ajax but its not working

Here's my example code:
function shared(){
//NOT WORKING
$.ajax({
type: "POST",
url: "http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes", //used to record that they clicked the share button
success: function(data){
alert("thank you for sharing");
}
});
 
}

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #93582 von DenisChenu
DenisChenu antwortete auf das Thema: trigger the url without visiting it
Hello,

There are 2 solution:
- Use your own script in completed page with something like;
example.org/thanks.php?srid={SAVEDID }
This script update the lime_survey_XXXX datatable, line srid.
- Do this before completed, at the last page: clicking shared check "Yes" to a yes/no question

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #93587 von Ben_V
Ben_V antwortete auf das Thema: trigger the url without visiting it
Hi,

If you want to store if a respondant was sharing or not, Denis's solution looks good.

If you also want to simply track how many times respondants were clicking on your share button and retrieve the survey ID (and maybe more infos) you should have a look here

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #93650 von agabriel
agabriel antwortete auf das Thema: trigger the url without visiting it
Hi Denis,

Sorry but i cant do that, the script must run and update the datatable if they click the FB share button in the completed page without navigating away in that same page.

To be exact i place the code in 'assessment.pstpl' because i wanted to share their assessment score in facebook and tracking the click in that button.

Cheers
Ali

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #93651 von agabriel
agabriel antwortete auf das Thema: trigger the url without visiting it
Hi Ben,

Thank you for your reply.

But my problem is triggering this link http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes // to update my datatable without navigating away from that page or visiting that link.

Ali

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #93667 von DenisChenu
DenisChenu antwortete auf das Thema: trigger the url without visiting it

agabriel schrieb: But my problem is triggering this link http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes // to update my datatable without navigating away from that page or visiting that link.

Then you need to doing it with an ajax call.

Don't use LS to update DB, a clean php file receving {SAVEDID} is better i think.
jQuery.ajax({
  type: 'GET',
  url: 'http://www.example.com/yourscript.php',
  data: {
    srid: '{SAVEDID}'
  }
});

yourscript just update answers in the survey table of the database srid is the "Textes complets id" of the line.
You can control if $_SESSION is open and is the srid is OK before updating it.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden um der Konversation beizutretten.

Mehr
4 Jahre 4 Monate her #94070 von agabriel
agabriel antwortete auf das Thema: trigger the url without visiting it

DenisChenu schrieb: yourscript just update answers in the survey table of the database srid is the "Textes complets id" of the line.
You can control if $_SESSION is open and is the srid is OK before updating it.

Denis


Hi Denis,

i dont have any idea what to place yourscript.php to update the srid database

can you please give me a sudo code that i will place in the yourscript.php so it can update the database?

Bitte Anmelden um der Konversation beizutretten.

Haben Sie schon bei unserer Kundenumfrage mitgemacht?

Verpassen Sie nicht Ihre Chance auf tolle Preise.

Klicken sie hier um teilzunehmen:

Jetzt starten

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten