Skip to main content

Updating the Store Locator Search Button Text

Tag Enhancer Plugin also supports dynamically updating the Store Locator search button text

RP Promap Help: Updating the Store Locator Search Button Text

Overview

The RP Promap Tag Enhancer Plugin also supports dynamically updating the Store Locator search button text by Passing Search Button Text via HTTP Parameter or adding it to the settings portion of your script.

Note this extends the existing tag enhancer plugin but can also be adapted as a standalone plugin. Link to Tag Enhancer Plugin Module

The RP Promap Tag Enhancer Plugin supports dynamically updating the Store Locator search button text using a URL parameter.

Supported parameter:

buttontext

Example:

https://example.com/pages/store-locator?buttontext=Find%20a%20Store

This allows you to:

  • Dynamically customize button labels

  • Reuse the same Store Locator page across campaigns

  • Create location-specific search experiences

  • Modify button text without editing the plugin configuration


Supported Element

The plugin targets:

<div class="scasl-search-btn">   <button id="bh-sl-submit" type="submit">     Search   </button> </div>

Selector used:

#bh-sl-submit

Add URL Parameter Support

Add this helper method to the plugin:

getUrlParameter: function (name) {   var params = new URLSearchParams(window.location.search);   return params.get(name); },

Update updateSearchButton()

Replace your existing function with:

updateSearchButton: function () {   var plugin = this;    var button = document.querySelector(plugin.selectors.searchButton);    if (!button) return;    var buttonText =     plugin.getUrlParameter("buttontext") ||     plugin.settings.searchButtonText;    if (!buttonText) return;    button.textContent = buttonText; },

This logic:

  1. Checks for ?buttontext=

  2. Falls back to settings.searchButtonText

  3. Updates the visible button label

Priority order:

HTTP Parameter → Plugin Setting → Default Button Text

Example URLs

Find a Store

https://example.com/pages/store-locator?buttontext=Find%20a%20Store

Find a Stockist

https://example.com/pages/store-locator?buttontext=Find%20a%20Stockist

Locate a Showroom

https://example.com/pages/store-locator?buttontext=Locate%20a%20Showroom

Recommended Plugin Configuration

settings: {   searchButtonText: "Search Locations" },

This acts as the default fallback if no HTTP parameter exists.


Example Full Integration

settings: {   searchButtonText: "Search Locations" },  selectors: {   searchButton: "#bh-sl-submit" },  getUrlParameter: function (name) {   var params = new URLSearchParams(window.location.search);   return params.get(name); },  updateSearchButton: function () {   var plugin = this;    var button = document.querySelector(plugin.selectors.searchButton);    if (!button) return;    var buttonText =     plugin.getUrlParameter("buttontext") ||     plugin.settings.searchButtonText;    if (!buttonText) return;    button.textContent = buttonText; },

Why This Works Reliably

The plugin already includes:

  • window.load

  • MutationObserver

  • limitedRetry()

  • debounce()

Because of this, the button text continues updating even if the Store Locator reloads dynamically after filtering or AJAX updates.


Important Notes

URL Encoding Required

Spaces should be URL encoded:

Find%20a%20Store

Not:

Find a Store

Text Only

This updates only:

button.textContent

It does not:

  • Change functionality

  • Modify form behavior

  • Affect Store Locator searches


Dynamic Rendering Safe

This feature should always run inside:

applyUpdates()

so the text persists after Store Locator re-renders.


Troubleshooting

Parameter not working

Check:

  • URL contains ?buttontext=

  • Text is URL encoded properly

  • plugin.updateSearchButton() runs inside applyUpdates()


Button text resets

Ensure:

plugin.startObserver();

is enabled.


Best Practice

Use both:

  • settings.searchButtonText

  • buttontext HTTP parameter support

This provides:

  • A safe default value

  • Flexible campaign overrides

Recommended architecture:

URL Parameter → Plugin Default → Native Button Text

© Rose Perl Technology

Did this answer your question?