Ongage Functions

Table of Contents:


General Functions 

Intro 

  1. The following functions can be used in the body of a message (email and/or SMS)
  2. A full list of all available functions can be found when clicking on the 'System Fields' button in the message editor.

URL Encoding Function

{{ocx_url_encode{http://www.somedomain.com/add}}}
 
Can be used in the following manner, let's say you have a parameter, that is a link, or simply a literal string of characters
that has spaces and/or other characters that requires URL encoding:
<a href="http://www.somedomain.com/click?redir={{ocx_url_encode{http://www.somedomain.com/options}}}">Click here for more info</a>
 
Note: the content of Ongage dynamic values are URL encoded so in the following case there is no need to use this function:
<a href="http://www.domain.com/?car={{model}}&year={{model_year}}">Click here for your car deals</a>

Unsubscribe Link Encoding Function

For Marketers who don't want Ongage to use default Unsubscribe tracking but want to use Encoded unsubscribe link as an URL Parameter, they can use this function. This function can be used in the following manner. 

Example Link:
<p><a href="https://www.somedomain.com?ongage_unsubscribe_link={{ocx_unsubscribe_link_encoded}}" link="">unsubscribe</a></p>

(warning)Before you use this function, it is recommended to disable default unsubscribe link enforcement from your account. You can contact Ongage Support to help you with needful setup.

Date Format Function

Enables the formatting of system date fields and list date fields within the body of the message {{list_field_name[format=d/m/Y]}} or {{system_field_name[format=M/d/y]}}

{{ocx_created_date[format=d/m/Y]}}
{{ocx_created_date[format=Y/m/d]}}

d - The day of the month (from 01 to 31)
D - A textual representation of a day (three letters)
j - The day of the month without leading zeros (1 to 31)
l (lowercase 'L') - A full textual representation of a day
N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday)
S - The English ordinal suffix for the day of the month (2 characters st, nd, rd or th. Works well with j)
w - A numeric representation of the day (0 for Sunday, 6 for Saturday)
z - The day of the year (from 0 through 365)
W - The ISO-8601 week number of year (weeks starting on Monday)
F - A full textual representation of a month (January through December)
m - A numeric representation of a month (from 01 to 12)
M - A short textual representation of a month (three letters)
n - A numeric representation of a month, without leading zeros (1 to 12)
t - The number of days in the given month
o - The ISO-8601 year number
Y - A four digit representation of a year
y - A two digit representation of a year
a - Lowercase am or pm
A - Uppercase AM or PM
g - 12-hour format of an hour (1 to 12)
G - 24-hour format of an hour (0 to 23)
h - 12-hour format of an hour (01 to 12)
H - 24-hour format of an hour (00 to 23)
i - Minutes with leading zeros (00 to 59)
s - Seconds, with leading zeros (00 to 59)
e - The timezone identifier (Examples: UTC, GMT, Atlantic/Azores)
I (capital i) - Whether the date is in daylights savings time (1 if Daylight Savings Time, 0 otherwise)
O - Difference to Greenwich time (GMT) in hours (Example: +0100)
P - Difference to Greenwich time (GMT) in hours:minutes 
T - Timezone abbreviations (Examples: EST, MDT)
Z - Timezone offset in seconds. The offset for timezones west of UTC is negative (-43200 to 50400)
c - The ISO-8601 date (e.g. 2013-05-05T16:34:42+00:00)
r - The RFC 2822 formatted date (e.g. Fri, 12 Apr 2013 12:01:05 +0200)
U - The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

Add offset to ocx_now to support dynamic date

This feature allows marketers to add tomorrow's date in the email content. This can be used as follows:

{{ocx_now[format=m/d/Y,offset=+1day]}}

For more information, there are more options available on how these parameters can be used. Options to use with the "offset" parameter are as follows:

  • +1 day
  • next Sunday/Monday/Tuesday etc...e.g: {{ocx_now[format=m/d/Y,offset=next tuesday]}}
  • -1 week
  • last Tuesday/Wednesday etc... e.g: {{ocx_now[format=m/d/Y,offset=last tuesday]}}
  • +1 month-3 days e.g: {{ocx_now[format=m/d/Y,offset=+1month-3days]}}

Math Calculation Function

{{ocx_math_eval}}

<table border=1>
    <tr>
        <td>Room Total</td>
        <td>Special Services</td>
        <td>Discount</td>
        <td>Total</td>
    </tr>
    <tr>
        <td>{{RoomTotal}}</td>
        <td>{{SpecialServices}}</td>
        <td>{{discount}}</td>
        <td>{{ocx_math_eval[ ( {{RoomTotal}} - {{SpecialServices}} ) * {{discount}} , format=%01.2f]}}</td>
    </tr>
</table>

Supported Operators:
+: Add
-: Subtract
*: Multiply
/: Divide
^: Power
%: Percent

Email Address Hashing Functions

Introduction

  • Ongage offers an advanced hashing function that by default does a SHA-1 hash. When used with the MD5 parameter, it will perform an MD5 hash.
  • This function is for use within the body of your HTML email, enabling you hash a dynamic field, typically the email.
  • The hashed email is typically stored in a system dynamic variable called {{ocx_custom_hash}} . If you're using an SMTP connection, that variable will work as is, in the case of ESP type connections, you will typically need to ask support to map that variable for you in the outbound ESP.

SHA-1 Hash 

SHA-1 is a cryptographic hash function designed by the United States National Security Agency. Following is how you can use it Ongage:

Place the following in the body of your HTML Email
This part generates the hash and assigns it into ‘ocx_custom_hash’ dynamic placeholder
{{ocx_generate_hash{data={{email}}}}}

Then you can use it in the body of your email in the following manner:
<a href="http://www.someurl.com?email={{ocx_custom_hash}}">Visit us here</a>


SHA-256 Hash 

The SHA-256 is a set of cryptographic hash functions designed by the National Security Agency (NSA). SHA stands for Secure Hash Algorithm. Following is how you can use it Ongage:

Place the following in the body of your HTML Email
This part generates the hash and assigns it into ‘ocx_custom_hash’ dynamic placeholder
{{ocx_generate_hash{algo=sha256,data=.....}}}
 
Then you can use it in the body of your email in the following manner:
href="http://www.someurl.com?email={{ocx_custom_hash}}">Visit us here</a>

MD5 Hash 

The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128-bit (16-byte) hash value, typically expressed in text format as a 32-digit hexadecimal number. MD5 is a one-way function. Following is how you can use it Ongage:

Place the following in the body of your HTML Email
This part generates the hash and assigns it into ‘ocx_custom_hash’ dynamic placeholder
{{ocx_generate_hash{algo=md5,data={{email}}}}}
 
Then you can use it in the body of your email in the following manner:
href="http://www.someurl.com?email={{ocx_custom_hash}}">Visit us here</a>

How to use all 3 hashing functions in the same email message

As of August 2016 you can now use all 3 hashing methods in the same email, here's how. We've added a new parameter to the ocx_generate_hash function called "name=" which you can indicate to store the hashed email and then use it as a dynamic variable in your email as demonstrated below:

// The name of the variable needs to start with "ocx_custom_hash_email_" then you can add any suffix you like:

{{ocx_generate_hash{algo=sha256,data={{email}},name=ocx_custom_hash_email_sha256}}}
ocx_custom_hash_email_sha256 = {{ocx_custom_hash_email_sha256}}

{{ocx_generate_hash{algo=sha1,data={{email}},name=ocx_custom_hash_email_sha1}}}
ocx_custom_hash_email_sha1 = {{ocx_custom_hash_email_sha1}}

{{ocx_generate_hash{algo=md5,data={{email}},name=ocx_custom_hash_email_md5}}}
ocx_custom_hash_email_md5 = {{ocx_custom_hash_email_md5}}

The previous way described above this sub-section still works, so that if you don't indicate name of the variable to store the hashed email in, then the hashed value ill be stored in: {{ocx_custom_hash_email}}.

How to implement LiveRamp with SHA-1 hash

Following is example of how to implement LiveRamp in an email sent from Ongage.

{{ocx_generate_hash{data={{email}}}}}

<img border="0" height="1" hspace="0" src="http://ei.rlcdn.com/123456.gif?s={{ocx_custom_hash}}&amp;n=1" vspace="0" width="1" />
<img border="0" height="1" hspace="0" src="http://ei.rlcdn.com/123456.gif?s={{ocx_custom_hash}}&amp;n=2" vspace="0" width="1" />
<img border="0" height="1" hspace="0" src="http://ei.rlcdn.com/123456.gif?s={{ocx_custom_hash}}&amp;n=3" vspace="0" width="1" />
<img border="0" height="1" hspace="0" src="http://ei.rlcdn.com/123456.gif?s={{ocx_custom_hash}}&amp;n=4" vspace="0" width="1" />
<img border="0" height="1" hspace="0" src="http://ei.rlcdn.com/123456.gif?s={{ocx_custom_hash}}&amp;n=5" vspace="0" width="1" />