TwinrDocs
Theme and screens / Custom

Custom

Runs your script, or taps something on your page for you.

A Custom Button does something rather than going somewhere. Use it when none of the other types fit — to run a piece of JavaScript, or to put a native button in the bar that triggers a control already on your web page.

Add one

On the screen's Navigation bar tab, click + Add, then choose Custom Button.

The Add Custom Button dialog showing Button Actions set to Execute Script, with Button Icon and Script fields

Button Actions comes first, because it changes the rest of the form.

Execute Script

Runs JavaScript on the current page each time the button is tapped.

Field What to enter
Button Icon* Choose a supplied icon or upload an image.
Script* The JavaScript to run.

The script runs against the page the customer is looking at, exactly as if you had typed it into a browser console on that page. It can read the page, change it, or call a function your site already defines.

Your script runs on whichever page the customer happens to be on. Have it check that what it needs is actually there before acting, or it will throw errors on pages you were not thinking about when you wrote it.

Web Page Element Click

Taps an element on your page for you.

Field What to enter
Button Icon* Choose a supplied icon or upload an image.
Element's identifier* The class or id of the element to click.

This is the simpler and more reliable of the two, and it covers the common case: you already have a working search button, filter or menu toggle on your site, and you want a native button in the bar that triggers it.

Find the identifier the same way as the cart counter — right-click the control on your site, choose Inspect, and read its class or id.

Prefer this over a script when you can. Clicking your own button means your site's existing code runs, so whatever that control already does — opening a drawer, tracking an event, validating a form — keeps working.

Visibility and analytics

Both actions also offer:

  • Visibility → User — All, logged-in only, or logged-out only.
  • Analytics → Track Click Event (Premium plan or your free trial) — records an event on each tap. See Custom Events.

Click Add, then Save as draft.

A Custom Button depends on your website's markup. Both the script and the element identifier break silently when your site changes — the button stays in the bar and simply stops doing anything. Test these after any theme update.