top of page

Templates : Custom Field : Macros for Dynamic Fields

In Lucit Templates dynamic fields are represented in object notation surrounded by either 1 or 2 sets of curly braces


In HTML and CSS Files, we use standard single curly brace notation


Basic Syntax

{item.price}

In Javscript, we use double-curly brace notation in order to provide additional escape protection

{{item.price}}

Objects

Generally, you will see support for the following objects



item

The inventory item to which this dynamic creative is attached. This could be a product, a vehicle, property, etc.

account

The account that this item belongs to

user

The user that created this item

digital_board

The digital screen that this creative is running on



Using Macros in HTML


HTML Elements connected to dynamic fields take a form like the following example.

Note the use of single curly-braces {} surrounding the price macro



<div
  x-objectcode="item_price"
  id="data_source_text_fcdue8jx"
  class="lc_ut_designer lc_dt_data lc_dt_text lc_format_fit_text lc_format_price_us"
  x-placeholder="25968"
  data-value="{item.price}">
  {item.price}
</div>

At render time, the following occurs in the following order:


  1. The data-value attribute is replaced with the value of the item price

  2. Any formatting functions are applied (in this case we have lc_format_fit_text and lc_format_price_us

  3. The final value is rendered in the innerHTML of the div



Using Macros in Javascript

In Javscript functions, we use the double-curly brace syntax in order to handle escaping issues when evaluating the functions.


Here is simple example that adds 500 to the price of the item



Note the double curly braces


Here is another example, using the fnConcat function.


Since this function requires strings, we must also enclose our macros in single quotes.



Standard Macros

There is a set of standard macros available on all templates. These exist regardless of the data source available, or, if you are building post templates.


Item Macros
Title	
{{item.title}}

Description	
{{item.description}}

Price	
{{item.price}}

Original Price	
{{item.price_original}}

Item Image	
{{item.options.primary_image_public_url}}

Item Image (No Background)	
{{item.options.primary_image_background_removed_public_url}}

Make	
{{item.make}}

Model	
{{item.model}}

Sub Model (Trim)	
{{item.sub_model}}

Year	
{{item.year}}

Stock #	
{{item.dealer_stock_number}}
Account Macros
Name	
{{account.name}}

Website	
{{account.website}}

Logo	
{{account.options.primary_image_public_url}}

Logo (No Background)	
{{account.options.primary_image_background_removed_public_url}}

User Macros
Name	
{{user.name}}

First Name	
{{user.first_name}}

Last Name	
{{user.last_name}}

Job Title	
{{user.title}}

Mobile Phone #	
{{user.mobile}}

Office Phone #	
{{user.office_phone}}

Email	
{{user.email}}

Profile Image	
{{user.options.primary_image_public_url}}

Profile Image (No Background)	
{{user.options.primary_image_background_removed_public_url}}

Screen Macros (Digital Board)
City	
{{digital_board.location.city}}

City Name Possessive	
{{digital_board.location.options.geo_city_name_possessive}}

State / Province	
{{digital_board.location.options.geo_state_name}}

State Possessive	
{{digital_board.location.options.geo_state_name_possessive}}

Country	
{{digital_board.location.options.geo_country_name}}

Country Possessive	
{{digital_board.location.options.geo_country_name_possessive}}

State / Province Code	
{{digital_board.location.region}}

State Code Possessive	
{{digital_board.location.options.geo_state_code_possessive}}

Postal Code	
{{digital_board.location.postal_code}}

Country Code	
{{digital_board.location.country}}

Country Code Possessive	
{{digital_board.location.options.geo_country_code_possessive}}


Data Source Macros

In addition to standard macros, data sources can create additional properties on item, account, and digital_board objects that you can use on templates for accounts that have added these data source applications


When data sources create additional macros, you will see them in your Dynamic Fields List, and you will also see a reference to them in the Custom Field editor


Here is an example from an Automotive data feed that created macros for various automotive things like body style, mileage, color, etc.




Here is another example of Weather related macros that are attached to the digital_board object



Each individual app may or should provide a reference to the macros that they provide in their application








bottom of page