# How can I access we web variables inside custom code, the one that loads on initial page load

**URL:** <https://community.weweb.io/t/how-can-i-access-we-web-variables-inside-custom-code-the-one-that-loads-on-initial-page-load/5762>\
**Category:** How do I?\
**Created:** [December 6, 2023, 1:53pm UTC](https://community.weweb.io/t/how-can-i-access-we-web-variables-inside-custom-code-the-one-that-loads-on-initial-page-load/5762 "2023-12-06T13:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devika](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@devika](https://community.weweb.io/u/devika)\
**Post date:** [December 6, 2023, 1:53pm UTC](https://community.weweb.io/t/how-can-i-access-we-web-variables-inside-custom-code-the-one-that-loads-on-initial-page-load/5762/1 "2023-12-06T13:53:51Z")

</div>

I want to access we web variables inside my custom code of a particular page on Load, how to achieve it its inside the body of the custom code of a particular pages body. Do check this and let me know.

scenario want to change id of video element as per the condition in my variable object

---

<div class="post-metadata">

**Author:** ![Trojan](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@Trojan](https://community.weweb.io/u/Trojan)\
**Post date:** [December 6, 2023, 4:51pm UTC](https://community.weweb.io/t/how-can-i-access-we-web-variables-inside-custom-code-the-one-that-loads-on-initial-page-load/5762/2 "2023-12-06T16:51:34Z")

</div>

Hi @devika You can do that using this method available  
**wwLib.wwVariable.getValue(“variable\_id”)**  
**wwLib.wwVariable.updateValue(“variable\_id”,newValue)**  
Also to find the any variable id you can simply fetch all the variable id’s or (details of collections,workflows etc) with this method  
**wwLib.$store.\_state.data.data.variables**  
**wwLib.$store.\_state.data.data.collections**  
You can try above methods in the browser console as well or in the **More \> Development \> Show dev information**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/8d57cca838afade0c83f70cdb870142f9ae27f13.png)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/67cc8383025f0ac7f79dace2a7e14c2b9527bc98.jpeg)

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [December 6, 2023, 6:08pm UTC](https://community.weweb.io/t/how-can-i-access-we-web-variables-inside-custom-code-the-one-that-loads-on-initial-page-load/5762/3 "2023-12-06T18:08:32Z")

</div>

Variable id are also available if you toogle the dev information

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b05bcdc2f0b44dcd9c243f5475498ce5f1cabd78.png)
