# Store JS code to run every time a Glide app is launched

**URL:** <https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474>\
**Category:** Ask for Help\
**Created:** [January 11, 2024, 2:37pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474 "2024-01-11T14:37:29Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreM](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AndreM](https://community.glideapps.com/u/AndreM)\
**Post date:** [January 11, 2024, 2:37pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/1 "2024-01-11T14:37:29Z")

</div>

Hi, I need expert assistance here please. Two questions: 1. Where would one store JS code to run every time a Glide app is launched? and 2. Where can I put JS code that will run on every single page? Many thanks!

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [January 11, 2024, 2:40pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/2 "2024-01-11T14:40:31Z")

</div>

JS code write into the JavaScript column… there is no such thing as running every single page… what do you mean by that?  
You can copy the response to every table.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [January 11, 2024, 2:51pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/3 "2024-01-11T14:51:49Z")

</div>

Hi Andre. Glide isn’t a traditional website builder where you could run JavaScript on each page or when the website first loads.

Have you looked at the Google Tag Manager integration? I’ve never used that integration, but it’s the closest I can think of that might allow you to run tags in your app.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [January 11, 2024, 3:00pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/4 "2024-01-11T15:00:57Z")

</div>

JavaSript will run as soon as you open the App… unless you put some conditions for execution 😉  
You put the code on tables, not on pages… pages run on tables… (just simplifying).  
If you run the code on the Users table, you can access it from anywhere without copying it.

@nathanaelb I start feeling bad for contradicting you so many times… 😅  
I want you to know that I really like you…

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [January 11, 2024, 3:13pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/5 "2024-01-11T15:13:55Z")

</div>

No worries at all Uzo!

I don’t think our comments contradict each other. Correct me if I’m mistaken of course, but the way I see it, JavaScript in Glide is used in tables to compute data. I don’t think this is what Andre is looking for.

The way I interpret Andre’s question, running JavaScript upon launch and on each page, is because he probably wants to insert JavaScript tags for tracking, social media, marketing and whatnot. This is a feature available on many website builders, but not Glide. So in the spirit of the question, I feel like what comes closest to maybe answering the question is looking at the Google Tag Manager integration. The Google Analytics and Mixpanel integrations might also do if what’s needed is tracking, but I feel GTM would cover more.

---

<div class="post-metadata">

**Author:** ![AndreM](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AndreM](https://community.glideapps.com/u/AndreM)\
**Post date:** [January 11, 2024, 3:14pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/6 "2024-01-11T15:14:54Z")

</div>

Thanks very much to both of you, I will try and revert asap

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [January 11, 2024, 3:15pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/7 "2024-01-11T15:15:06Z")

</div>

Oh, now I get what you mean. Yep, that makes sense.  
So… for others to understand Glide better… imagine that the Front editor is your HTML file…  
Table editor, you divide into Computing columns… which would be your JS file and Static columns… your Storage/Database…SQL.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 11, 2024, 11:51pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/8 "2024-01-11T23:51:03Z")

</div>

Thread was renamed to a shorter version, it contained the full post before.

---

<div class="post-metadata">

**Author:** ![AndreM](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AndreM](https://community.glideapps.com/u/AndreM)\
**Post date:** [January 12, 2024, 7:48am UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/9 "2024-01-12T07:48:31Z")

</div>

Thanks Nathaneal and Uzo, I sincerely appreciate your consideration! I should have included our objective. We are looking to find a workaround for a Glide shortfall. Glide doesn’t terminate the session on closing a browser window and returns a User to the open App when the User decides to come back. This is obviously a huge security oversight. We’re looking to inject some simple JS code to address this flaw but aren’t sure where on Glide it resides. Please could you assist or suggest another way to overcome the security issue, thanks

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [January 12, 2024, 1:26pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/10 "2024-01-12T13:26:37Z")

</div>

I cannot think of anything to force a logout, sorry 🙏

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 12, 2024, 1:28pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/11 "2024-01-12T13:28:23Z")

</div>

> [@Glide major security flaw - Apps remain open after browser closed](https://community.glideapps.com/t/glide-major-security-flaw-apps-remain-open-after-browser-closed/69504/2):
>
> Turn off the User Authentication Cookie.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [January 12, 2024, 2:45pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/12 "2024-01-12T14:45:11Z")

</div>

Aren’t we missing a setting?

_Always set authentication cookie_  
Users stays signed in until they do something (which we cannot control).  
This is the default.

_Asking users for consent_  
If users select “Keep me signed in”, something we cannot control, then they will stay signed in until they do something (back to the case above).  
The checkbox here is also out of our control.

Aren’t we missing  
_Never set authentication cookie & force sign out after [n] minutes of inactivity_  
or something like that?

 ![Screenshot 2024-01-12 at 14.33.23](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/6/f656b0ac8af46c4af19fc62e0630d7d42a4f88f0.jpeg)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 12, 2024, 2:56pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/13 "2024-01-12T14:56:58Z")

</div>

Yeah, I guess ideally in this case, the user wouldn’t be given a choice when they sign in, so a third option would make sense. Probably worth it a feature request.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [January 12, 2024, 3:04pm UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/14 "2024-01-12T15:04:20Z")

</div>

Unfortunately there is no logout action that I know of. The sign-out button is a little hidden in the hamburger menu and unlikely to be used that often or remembered.

---

<div class="post-metadata">

**Author:** ![r\_j](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/r_j/32/75932_2.png) [@r\_j](https://community.glideapps.com/u/r_j)\
**Post date:** [October 4, 2024, 12:34am UTC](https://community.glideapps.com/t/store-js-code-to-run-every-time-a-glide-app-is-launched/69474/15 "2024-10-04T00:34:17Z")

</div>

can the new custom code component be used for a custom tracker similar to a Google tag? I put the same snippet on every page.
