# Custom javascript in WriteFreely 0.81

**URL:** <https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348>\
**Category:** WriteFreely\
**Created:** [February 5, 2019, 12:31am UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348 "2019-02-05T00:31:51Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugbuster](https://discuss.write.as/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@bugbuster](https://discuss.write.as/u/bugbuster)\
**Post date:** [February 5, 2019, 12:31am UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/1 "2019-02-05T00:31:51Z")

</div>

Created a local Windows 10 Development install of WriteFreely 0.81 to get familiar with it.

On the Customization page, I see how to input Custom CSS, but I don’t see anything for entering custom Javascript. Does this capability exist in WriteFreely 0.81?

---

<div class="post-metadata">

**Author:** ![matt](https://discuss.write.as/user_avatar/discuss.write.as/matt/32/2760_2.png) [@matt](https://discuss.write.as/u/matt)\
**Post date:** [February 6, 2019, 1:31pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/2 "2019-02-06T13:31:43Z")

</div>

There’s no way to use custom Javascript in WriteFreely 0.8.1.

I left it out to prevent security issues that might come up on multi-user instances. But are you running a single-user instance?

---

<div class="post-metadata">

**Author:** ![bugbuster](https://discuss.write.as/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@bugbuster](https://discuss.write.as/u/bugbuster)\
**Post date:** [February 6, 2019, 2:42pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/3 "2019-02-06T14:42:44Z")

</div>

Yes, a single-user instance on a local machine with sqlite3, I might use it for keeping track of notes, references, links, to-do list items, items I won’t post online, etc. Got it up and running with no issues, instructions were very helpful.

---

<div class="post-metadata">

**Author:** ![Aris](https://discuss.write.as/user_avatar/discuss.write.as/aris/32/58_2.png) [@Aris](https://discuss.write.as/u/Aris)\
**Post date:** [February 7, 2019, 3:33am UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/4 "2019-02-07T03:33:31Z")

</div>

Maybe this can be an option for admin on a per instance (or per blog) basis. Personally I use JS on Write.as to insert non-breaking spaces used by French typographic rules… Very useful.

---

<div class="post-metadata">

**Author:** ![Aris](https://discuss.write.as/user_avatar/discuss.write.as/aris/32/58_2.png) [@Aris](https://discuss.write.as/u/Aris)\
**Post date:** [February 8, 2019, 6:13pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/5 "2019-02-08T18:13:17Z")

</div>

I made a post on one of my blogs about custom JavaScript and French typography in Write.as… obviously it’s in French 🕶

> **[Des insécables dans le texte avec Write.as](https://lab.papatheodorou.net/des-insecables-dans-le-texte-avec-write-as)**
>
> Avec un blog hébergé sur Write.as il est possible d’injecter du JavaScript dans le header de chaque page. Une possibilité que j’ai utilis...

---

<div class="post-metadata">

**Author:** ![bugbuster](https://discuss.write.as/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@bugbuster](https://discuss.write.as/u/bugbuster)\
**Post date:** [February 8, 2019, 8:07pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/6 "2019-02-08T20:07:03Z")

</div>

Thanks for posting, Aris. I found that [https://translate.google.com](https://translate.google.com) did a good job of converting it to English.

---

<div class="post-metadata">

**Author:** ![macdonaldster](https://discuss.write.as/user_avatar/discuss.write.as/macdonaldster/32/160_2.png) [@macdonaldster](https://discuss.write.as/u/macdonaldster)\
**Post date:** [February 12, 2019, 12:01pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/7 "2019-02-12T12:01:28Z")

</div>

Hi, I just set up a single instance blog on my VPS with WriteFreely… Can I place some JS into a template file or something? I am going to be poking around myself but thought I would ask if there was a best practice first.

Great blogging software! I love the ease of use and minimalist approach.

---

<div class="post-metadata">

**Author:** ![macdonaldster](https://discuss.write.as/user_avatar/discuss.write.as/macdonaldster/32/160_2.png) [@macdonaldster](https://discuss.write.as/u/macdonaldster)\
**Post date:** [March 20, 2019, 11:20am UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/8 "2019-03-20T11:20:43Z")

</div>

I eventually just put my JS snippet into every template file and restated WF. It seems to have worked. I was trying to find a “footer” template (or any “every page” template) but nothing I found seemed to include the script on every page so I gave up and just put it everywhere. Not super-helpful to anyone else but hopefully, someone will figure out how to do this better than I have.

---

<div class="post-metadata">

**Author:** ![matt](https://discuss.write.as/user_avatar/discuss.write.as/matt/32/2760_2.png) [@matt](https://discuss.write.as/u/matt)\
**Post date:** [March 20, 2019, 2:54pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/9 "2019-03-20T14:54:05Z")

</div>

Hey, sorry I never got back to you earlier. It’s true the templates aren’t really set up for this right now.

I think ultimately we’re moving towards having common elements like this stored in the database and editable from the admin interface – and ideally supporting this by v1.0. So if you don’t mind sharing, what was the JS for? This will help inform what kind of capabilities we build.

---

<div class="post-metadata">

**Author:** ![macdonaldster](https://discuss.write.as/user_avatar/discuss.write.as/macdonaldster/32/160_2.png) [@macdonaldster](https://discuss.write.as/u/macdonaldster)\
**Post date:** [March 20, 2019, 3:15pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/10 "2019-03-20T15:15:07Z")

</div>

Hi Matt, the JS was Google Analytics tracking code. I get NO traffic but I like to have analytics there just for fun. I am a web developer, though, and would like to have a way to add on JS I write if I want to make a custom widget or something for the front end.

```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXX-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-1');
</script>
```

---

<div class="post-metadata">

**Author:** ![rgx2](https://discuss.write.as/user_avatar/discuss.write.as/rgx2/32/825_2.png) [@rgx2](https://discuss.write.as/u/rgx2)\
**Post date:** [December 10, 2020, 8:33pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/11 "2020-12-10T20:33:14Z")

</div>

> [@matt](#):
>
> So if you don’t mind sharing, what was the JS for? This will help inform what kind of capabilities we build.

Sorry to dig up an old thread, Matt - but I am just looking for the same possibility of running light javascript in some WF pages.

I imagined it was off for security reasons; and asked my gracious host, at [https://write.tedomum.net/](https://write.tedomum.net/) for assistance. They pointed me to this thread.

I have a very short script which is useful for a Custom Google Search engine, strictly for my own blog pages. It works well, but would be ideal if this could be an option - allowed in the Settings panel, possibly?

It might be shown in the footer of every page, and the user configurable parameter would be simply the string of characters **cx** , that defines the specific page as added by the user to GCSE. This code is what I need :

```
`<script async src="https://cse.google.com/cse.js?cx=3e384e93bce23813b"></script>`
`<div class="gcse-searchbox"></div>`

and the results area below :

`<div class="gcse-searchresults"></div>`

```

Thank you !

---

<div class="post-metadata">

**Author:** ![spiffytech](https://discuss.write.as/user_avatar/discuss.write.as/spiffytech/32/1278_2.png) [@spiffytech](https://discuss.write.as/u/spiffytech)\
**Post date:** [September 14, 2021, 2:59pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/12 "2021-09-14T14:59:51Z")

</div>

Are script includes on the roadmap? I checked Phabricator but didn’t see it there.

I’m mostly interested in including an analytics script tag (not GA).

---

<div class="post-metadata">

**Author:** ![infuerno](https://discuss.write.as/user_avatar/discuss.write.as/infuerno/32/1589_2.png) [@infuerno](https://discuss.write.as/u/infuerno)\
**Post date:** [February 6, 2022, 9:00pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/14 "2022-02-06T21:00:59Z")

</div>

I managed to sneak my analytics JS code into the end of the Custom CSS box by ending the `</style>` tag, adding the JS and then opening another `<style>` tag.

e.g.

```auto
/* custom CSS */
</style>

<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
	a[h]=a[h]||function(){
		(a[h].q=a[h].q||[]).push(arguments)
	};
	o=f.createElement('script'),
	m=f.getElementsByTagName('script')[0];
	o.async=1; o.src=t; o.id='fathom-script';
	m.parentNode.insertBefore(o,m)
})(document, window, '//fathom.domain.com/tracker.js', 'fathom');
fathom('set', 'siteId', 'ABCDE');
fathom('trackPageview');
</script>
<!-- / Fathom -->

<style type="text/css">
/* closed by the code which injects the custom CSS */

```

---

<div class="post-metadata">

**Author:** ![cri](https://discuss.write.as/user_avatar/discuss.write.as/cri/32/5849_2.png) [@cri](https://discuss.write.as/u/cri)\
**Post date:** [November 29, 2023, 12:34am UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/15 "2023-11-29T00:34:25Z")

</div>

OMG, I LOVE THIS!! THANKS YOU VERY MUCH! ❤

---

<div class="post-metadata">

**Author:** ![taniki](https://discuss.write.as/user_avatar/discuss.write.as/taniki/32/3376_2.png) [@taniki](https://discuss.write.as/u/taniki)\
**Post date:** [November 29, 2023, 6:17pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/16 "2023-11-29T18:17:38Z")

</div>

I just tried @infuerno hack and it is a very good shortcut to add plausible to a specific blog without creating a breach on drafts. thanks very clever and simple.

---

<div class="post-metadata">

**Author:** ![cri](https://discuss.write.as/user_avatar/discuss.write.as/cri/32/5849_2.png) [@cri](https://discuss.write.as/u/cri)\
**Post date:** [February 8, 2024, 10:32pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/17 "2024-02-08T22:32:50Z")

</div>

anyone has tried to add cusdis with @infuerno 's hack?

I m trying to doing with this method, but it is not working for me

---

<div class="post-metadata">

**Author:** ![cri](https://discuss.write.as/user_avatar/discuss.write.as/cri/32/5849_2.png) [@cri](https://discuss.write.as/u/cri)\
**Post date:** [February 8, 2024, 10:37pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/18 "2024-02-08T22:37:38Z")

</div>

> [@matt](#):
>
> I think ultimately we’re moving towards having common elements like this stored in the database and editable from the admin interface – and ideally supporting this by v1.0. So if you don’t mind sharing, what was the JS for? This will help inform what kind of capabilities we build.

Hi @matt i hope you are well. I would like to know, why is there no custom javascript for single-user instances?

Best regards

---

<div class="post-metadata">

**Author:** ![MahaskaVillage](https://discuss.write.as/user_avatar/discuss.write.as/mahaskavillage/32/2948_2.png) [@MahaskaVillage](https://discuss.write.as/u/MahaskaVillage)\
**Post date:** [June 24, 2024, 4:58pm UTC](https://discuss.write.as/t/custom-javascript-in-writefreely-0-81/348/19 "2024-06-24T16:58:24Z")

</div>

I was able to add the fathom hit counter but I’ve been trying to add a MySQL call to get the `collections` titles so that it automatically displays on the “welcome” post…

No luck yet ☹
