Generating a dynamic javaascript file

I am wondering if it’s possible to generate a .js file dynamically for each of my app’s users to add to their own websites by copy/paste of the file URL into their own site header or tag manager?

It would be ideal if I could use a workflow to generate the file when the user establishes their account and the file would have a unique file name and variable data unique to each user’s account.

I was looking at using “Run Javascript” as an action using the Toolbox plugin, or just outputting code onto a page, but neither solution ends up with a javascript file with a path that I can reveal to my users.

New to this, so I appreciate it if you go easy on me if there’s an obvious answer! Thanks!

Yep, check out the Text File Conjurer plugin.

2 Likes

Looks exactly like what I need. Thanks!

1 Like

@lantzgould this got me really close but the documentation is missing for this plugin so I’m struggling here. Using Upload FileConjurer I can get the perfect file into the file manager, but then how to reference the URL of the file or how to upload it to a thing is the question. There’s no option to “use result of step X” in subsequent actions, and also no way to reference the file’s unique URL. I see “attach to thing” as an option in the action but when I do that nothing is attached, even if the thing I’m attaching it to has a file upload field. I’m sure I’m missing a step but again I don’t see any docs. Any help is appreciated!

See if this helps:


Demo:

Editor:

1 Like

@lantzgould - Oh I see! One must create a new workflow and reference “Elements > A File Conjurer Save” as the event. That works great! Curious if you’ve ever run into an issue with the “Delete an Uploaded File” action when attempting to remove a thing’s attached text file (in my case, .js). Thanks for the demo, that was incredibly helpful.

You’re very welcome!

Re: Delete an Uploaded File issue, I can’t say I have. Can you share screenshots of your workflow?

OK, good to know. I was having an issue deleting and determined it was a privacy setting preventing the attached file from participating/showing up in the conditional logic I was using in my workflow that was looking for it and only found an empty file. Once I changed the privacy setting it worked beautifully. Thanks for your help!

1 Like