Define a page group with JavaScript Variable

Capture the value of an existing JavaScript variable on your site to define your page group.

Before you begin

The JavaScript variable can be coded anywhere on the page and at any time before the page finishes loading (in other words, before the beacon is sent), and must be globally readable.

You can also insert a specific JavaScript snippet in to your pages to define a page group, using any logical grouping of unique identifiers or symbols (namespace) that you choose.

If you have other tools in place that use JavaScript, this is an easy way to define your page groups.

These steps show you how to use the JavaScript Variable method to define a page group using the value of a variable in your source code.

How to

  1. In the Variable Name field, enter the name of variable that you want to use for your group name (for example, LOGIN.pg).
    Note: Use alphanumeric characters, dashes, underscores, and spaces only. The maximum character length is 100. If your page name exceeds this limit, it'll be truncated.
  2. To check that the correct value is captured, in the Enter Test URL field, enter a URL that includes the variable that you want applied to the page group (for example, https://www.example.com), and then click Test.
  3. If the match is successful, that row turns green and the name of the page group appears in the Result field. Click OK to save the configuration.
    In this figure, you can see Value of variable: LOGIN.pg.