Woopra Templates

Templates are used to dynamically insert content into text placeholders. These are used in our Schemas and in our Automation and Triggers.

There are two main uses for Woopra templates:

  • Determining how an event looks in the visitor profile (i.e: "Viewed Page /docs" instead of "Did pageview").
  • Using event and visitor properties in the configuration of an automation like a trigger, for instance when sending a text message or transactional email in which you want to include a visitor property like the person's name, or an action property like the url of their abandoned cart.

The Templating System

Woopra templates use the ${ and } format for template expressions. In general the format will be:
${<SCOPE>(visitor|action|visit).<property name>}.

The available scopes are visitor, action, and visit. The visitor scope means visitor properties like a visitor's first_name. The Action scope means action/event properties, like the url of a pageview event. The visit scope has session level properties such as browser or ip.

Templating Values

The SCOPE part allows you to declare if you are referring to a session/visit property, a visitor property, or to an action property of the current action (in the case of a trigger, this would be the action that is selected in the "trigger when" section when you define your trigger.)

To see what action properties are available for a given action, it is best to go check out your event schemas in the Woopra interface: Configure > Action Schemas. Similarly, you can see what properties/fields you have defined in your schemas for visitors in Configure > Visitor Schemas.

A visit scope allows you to use a visit property which actually applies to many actions. For instance things like: ip address, referer/source, Operating system, browser, etc. are all visit properties and can be accessed in templates using, e.g.: ${visit.browser} For more on the visit scope and properties, see Visitor Properties, and finally Generated Visit Properties which discusses a few properties like browser that are generated automatically when possible, and generally available in any templating situation. They are not always present, however. For example, you wouldn't expect to have a visit.browser on a session that only includes a serverside event like "email bounced" in which the visitor never actively used a browser to interact with your system.

Escaping JSON

Woopra also supports escaping values that are injected into a Javascript context. For example, you can use ${visitor.name | json} to escape the text into "First Last".