Dynamic URLs & content

How to create URLs that contain dynamic fields (like an org id). The same behavior even lets you customize step content!

Emily Wang avatar
Written by Emily Wang
Updated over a week ago

Some URLs in your app my have dynamic attributes that are different for every user. You can navigate to those URLs in Bento using our dynamic attributes.

You can add known user or account attribute replacements into the URL by typing {{ and selecting one of the attributes in the dropdown that pops up.

URLs are the crux of so many experiences in Bento

  • Location of guides in-app

  • Links in content

  • CTAs

Instead of needing to change the URLs across environments for staging vs. production you can use various tools.

As an example, let’s say Acme Co has 2 environments with urls structured like:

Wildcards

  • Add an * to the URL to replace a changing field in the URL

  • This works best for fields that are not associated with an account or user

  • There is always a risk that the ambiguity of the wildcard prevents the experience from appearing consistently where you expect it

  • In our example, our new URL could be https://*.acme.co/

    • This means that the guide you are launching will appear in any environment that has the Bento snippet installed and follows this URL structure

Dynamic attributes

  • Add an {{attribute/variable}} to reference an attribute/variable that is associated with the user or account in the URL

  • This is more reliable in ensuring the right users are seeing the right experiences in the right place

  • You need to pass these attributes into Bento as part of the snippet installation or via Segment, you can see all your attributes in the data tab

  • This works for data that is on the user or account level

  • In our example, our new URL might look like https://staging.acme.co/{{account:ID}}

Regex

  • If your different environments are not at the same https:// vs. http:// you can use Regex like this: (http|https)://

  • For example: (http|https)://(localhost:3000|other version|other path)

  • In our example, our URL might look like https://(staging | app).acme.co/

  • This works great when there are finite options and they don't differ by user or account

Placeholder URLs

When using wildcards it is more difficult to preview your content in your app, since Bento doesn't know what to replace the attribute with.

When using a wildcard in targeting, Bento will ask for a placeholder URL or an example URL of where you would want the guide to show up.

In this case, paste in the URL without any attributes or wildcards. It will only be used for previewing certain experiences.

Did this answer your question?