Here’s how you can Pass URL parameters to your Pickaxe. This is a clever trick that allows your Pickaxe to already know certain things, such as who the user is. @nathaniel coded this up over the weekend.
To this, you’ll have
- To use a script embed (not an iframe).
- Then add another script section, which assigns a dict value to PickaxeConfig within the dom of the page.
Here’s an example of what it looks like:
<script>
window.PickaxeConfig = {
param1: "Hello World",
param2: "Goodbye World",
};
</script>
<script src="https://studio.pickaxe.co/api/embed/bundle.js" defer></script>
Then when you run an action, you can access these values like this:
import json
import os
values = json.loads(os.environ["PICKAXE_FRONTEND_PICKAXE_CONFIG"])
values
will contain a dictionary containing your values. You can use the action to read them back, or do other things with them!