---
title: Adding Page-Specific Code Using the Global PageName Function
description: You can write code that will only execute on specific pages of your storefront (for example, product pages only, category pages only, etc.).
---

[Skip to content](https://help.volusion.com/s/addingpage-specificcodeusingtheglobalpagenamefunction#main-content)

English - United States

Show submenu for translations

![Volusion Logo](https://help.volusion.com/hs-fs/hubfs/Color_Logo_Horizontal.png?width=1500&height=1500&name=Color_Logo_Horizontal.png)

Open main navigation

Close main navigation

- English - United States
  
  Show submenu for translations
- [Contact Us](https://volusion.com/contact)

[Contact Us](https://volusion.com/contact)

 Search the Help Center

- There are no suggestions because the search field is empty.

1. [Volusion Help Center](https://help.volusion.com/s?hsLang=en-us)
2. [V1](https://help.volusion.com/s/v1?hsLang=en-us)

# Adding Page-Specific Code Using the Global PageName Function

You can write code that will only execute on specific pages of your storefront (for example, product pages only, category pages only, etc.). As always, please archive your theme before making any changes.

After you've written your page-specific code, paste it into the script provided below. Replace with the page you want your code to run on. Then, put the full script (with your custom code) into your template\_xx.html file, where "xx" is the name or ID number of your theme, at **Design** \>  **File Editor** \>  **Shortcuts**.

```
<script>var Page = PageName() || 'default.asp';if( Page === 'one-page-checkout') {  console.log("THIS RUNS ON THE CHECKOUT PAGE")} else if (Page === 'productdetails.asp') {  console.log("THIS RUNS ON THE PRODUCT DETAILS PAGE")} else {  console.log("THIS WILL RUN ON OTHERS PAGES AND OUTPUT THE PAGENAME:"+Page)}</script>
```

- [Getting started](https://help.volusion.com/s/getting-started?hsLang=en-us)
- [Manage Your Store](https://help.volusion.com/s/manage-your-store?hsLang=en-us)
- [Marketing for Success](https://help.volusion.com/s/marketing-for-success?hsLang=en-us)
- [Volusion Payment Powered by Stripe](https://help.volusion.com/s/volusion-payment-powered-by-stripe?hsLang=en-us)
- [Partner Marketplace](https://help.volusion.com/s/partner-marketplace?hsLang=en-us)
- [Support](https://help.volusion.com/s/support?hsLang=en-us)
- [V1](https://help.volusion.com/s/v1?hsLang=en-us)
- [Security](https://help.volusion.com/s/security?hsLang=en-us)

[![Volusion Logo](https://help.volusion.com/hs-fs/hubfs/Color_Logo_Horizontal.png?width=1500&height=1500&name=Color_Logo_Horizontal.png "Volusion Logo")](https://volusion.com/)

<https://www.facebook.com/> <https://www.twitter.com/> <https://www.instagram.com/> <https://podcasts.apple.com/> [mailto:email@email.com](mailto:email@email.com)

Copyright © 2026, Volusion