Custom parameters

Custom parameters can be added to the URL passed to the content rendering service. These parameters can then be referenced from within your handlebars templates, allowing you to implement different functionality based on variables such as locale or device, for example.

The params are included in the URL query parameters as follows:

?crparam.device=kiosk&crparam.account=amplience

With an example full URL for a content item:

https://c1.adis.ws/v1/content/ampproduct/content-item/07be26bb-bc37-4ade-97f9-1ba8979f4cba?template=example_params&crparam.device=kiosk&crparam.account=amplience

The content rendering service includes a crParam namespace that contains the custom parameters. In the example above we are passing 'device' and 'account' parameters.

To access the custom parameters use the crParams helper, as shown below:

{{crParam 'device' .}}
{{#if (crParam 'device' .)}}

An example handlebars template that displays the result of a 'device' and 'account' custom parameter is shown below. You would access your own parameters from crParam as shown in the example.

<h1>Passed params template</h1>

<p>Query string parameters can be passed to handlebars templates using the crParam namespace:</p>
<p><code>?crparam.device=kiosk&crparam.account=amplience</code></p>

{{#if (crParam 'account' .)}}
    <h2>Passed param: account</h2>
  <p>{{crParam 'account' .}}</p>
{{/if}}

{{#if (crParam 'device' .)}}
    <h2>Passed param: device</h2>
  <p>{{crParam 'device' .}}</p>
{{/if}}

results matching ""

    No results matching ""