# SONA integration with URL

**URL:** <https://discourse.psychopy.org/t/sona-integration-with-url/19873>\
**Category:** Online experiments\
**Created:** [January 24, 2021, 5:41pm UTC](https://discourse.psychopy.org/t/sona-integration-with-url/19873 "2021-01-24T17:41:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darcyen](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@darcyen](https://discourse.psychopy.org/u/darcyen)\
**Post date:** [January 24, 2021, 5:41pm UTC](https://discourse.psychopy.org/t/sona-integration-with-url/19873/1 "2021-01-24T17:41:07Z")

</div>

URL of experiment: [https://run.pavlovia.org/ennadarcy/testingaslearning](https://run.pavlovia.org/ennadarcy/testingaslearning)

Description of the problem: For integrating SONA with the online experiment I was required to enter a ‘completed URL’, given to me from the SONA site, in the experiment settings so that students access the experiment through SONA could be awarded credits automatically.

I entered ‘html’ into the output path, and this URL for the completed URL

$”[https://tcd-psy.sona-systems.com/webstudy\_credit.aspx?experiment\_id=105&credit\_token=399d75fda3b546dcbc91bb9c6c20fec5&survey\_code=”+expInfo[‘participant’]](https://tcd-psy.sona-systems.com/webstudy_credit.aspx?experiment_id=105&credit_token=399d75fda3b546dcbc91bb9c6c20fec5&survey_code=%E2%80%9D+expInfo%5B%E2%80%98participant%E2%80%99%5D)

When I tried to sync the amendments to the experiment online the following error occurred:

Traceback (most recent call last):  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1221, in onPavloviaSync  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 719, in fileExport  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in \_makeTarget  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/\_experiment.py”, line 225, in writeScript  
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/settings/ **init**.py”, line 598, in writeExpSetupCodeJS  
TypeError: **str** returned non-string (type NoneType)

I also tried to remove the outpath path as ‘html’ but then it wouldn;t even allow me to enter the completed URL in the settings.

Any ideas? Does anyone maybe recognise something that might be off with the URL?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [January 24, 2021, 10:43pm UTC](https://discourse.psychopy.org/t/sona-integration-with-url/19873/2 "2021-01-24T22:43:24Z")

</div>

Have you accidentally used smart quotes instead of dumb ones?

---

<div class="post-metadata">

**Author:** ![darcyen](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@darcyen](https://discourse.psychopy.org/u/darcyen)\
**Post date:** [January 25, 2021, 10:48am UTC](https://discourse.psychopy.org/t/sona-integration-with-url/19873/3 "2021-01-25T10:48:58Z")

</div>

No they were dumb quotes. I re-entered the completion URL there this morning into the eperiment settings and it synced. I then ran the experiment, from the pavlovia site and both parts of the experiment worked.

Then I tried to run part both parts of the experiment through the SONA site as a student following the link. The experiment loaded but the following error occurred when I tried to progress beyond the welcome screen by pressing the right arrow key

Error: Unfortunately we encountered the following error: Type Error: Cannot read property ‘0’ of undefined.

This appeared when entering the experiment from both links on the SONA website. Any ideas?

---

<div class="post-metadata">

**Author:** ![darcyen](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@darcyen](https://discourse.psychopy.org/u/darcyen)\
**Post date:** [January 25, 2021, 11:53am UTC](https://discourse.psychopy.org/t/sona-integration-with-url/19873/4 "2021-01-25T11:53:36Z")

</div>

I think this is an issue with integration between SONA and PsychoPy. I removed the coding  
?participant=%SURVEY\_CODE% from the end of the experiment URL, and it’s now running fine through the SONA site.

This addition to the URL is supposed to allow automatic notification when a student completes the experiment so that SONA can automatically add credits. As I can do this manually, with researcher status on SONA, I have removed this addition to the experiment URL, so that I can just run my experiment.

Thank you for your help.
