question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing extra variables to ad.html and consent.html: 2pts

See original GitHub issue

It is often useful to pass extra variables to ad.html or consent.html, however this ability is not currently provided by Dallinger. The “/ad” route is long and complex, and finishes like this:

return render_template(
    "ad.html",
    recruiter=recruiter_name,
    hitid=hit_id,
    assignmentid=assignment_id,
    workerid=worker_id,
    mode=config.get("mode"),
    app_id=app_id,
)

We would like to be able to inject extra variables into this render_template call, with these variables being defined as a class attribute on the Experiment class (see extra_files for a similar approach. Likewise, we would like to be able to inject extra variables into the render_template call for consent.html.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pmcharrisoncommented, Jan 4, 2021

Thanks for checking, @jessesnyder! I agree, guess that’s it then 😃 Although, I still agree with @alecpm that it would be worth documenting if it’s not documented already.

0reactions
jessesnydercommented, Jan 4, 2021

A @property decorator seems to work fine, so it sounds like we can close this issue(?)

Experiment class:

    @property
    def time(self):
        return "The time is now."

Template:

<h3>From injected experiment:</h3>
<pre>{{ experiment.time }}</pre>

Output: Psychology_Experiment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pass a Variable Value from One HTML Page to Another
Source code: https://openjavascript.info/2022/06/09/ pass -data-from-one- html -page-to-another/⚡ Looking for high-performance, affordable web ...
Read more >
How do I pass custom data and variables into the ad?
You can pass a custom value into the ad tag and our ad server will pass that same value along to the actual...
Read more >
Passing a variable from node.js to html - Stack Overflow
To pass variables from node.js to html by using the res.render() method. Example:
Read more >
Using dynamic ad variables in AWS Elemental MediaTailor
Passing parameters to the ADS​​ In the URL, include static parameters and include placeholders for dynamic parameters. Enter your template URL in the ......
Read more >
Passing information to HTML ad | Support
Another way to access is to mark in your HTML code the variables via macros so that they will be passed on. PS:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found