Difference between revisions of "Functions:TEMChannelTag"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(created...)
 
(added email attribute)
 
Line 3: Line 3:
  
 
== Syntax ==
 
== Syntax ==
$tag = eV::TEMChannelTag($channel_id[,$dataArr][,$environment=test])
+
$tag = eV::TEMChannelTag($channel_id,$email,[,$dataArr][,$environment=test])
  
 
== Paramaters ==
 
== Paramaters ==
 
*$channel_id CHAR REQUIRED
 
*$channel_id CHAR REQUIRED
 
:: specifies the channel id, as assigned by Trigger Email Marketing.
 
:: specifies the channel id, as assigned by Trigger Email Marketing.
 +
*$email CHAR REQUIRED
 +
:: specifies the email address associated with this trigger. It is recommended to use the [[functions:orderGetEmail|orderGetEmail]] function to retrieve this.
 
*$dataArr ARRAY OPTIONAL
 
*$dataArr ARRAY OPTIONAL
 
:: keyed array of customer facts, conversion facts, abandoned cart or cart item data. See the TEM API data specification for available fields.
 
:: keyed array of customer facts, conversion facts, abandoned cart or cart item data. See the TEM API data specification for available fields.
Line 26: Line 28:
 
// this is provided by TEM
 
// this is provided by TEM
 
$channel_id = "12345";
 
$channel_id = "12345";
 +
 +
// get order data which will be used to extract email, first name
 +
$orderArr = eV::orderGetCompleteArray();
 +
 +
// get email which is required
 +
$email = eV::orderGetEmail($orderArr);
  
 
// we also want to pass the first name
 
// we also want to pass the first name
 
// this is an optional customer fact
 
// this is an optional customer fact
$orderArr = eV::orderGetCompleteArray();
 
 
$firstName = eV::orderGetFirstName($orderArr);
 
$firstName = eV::orderGetFirstName($orderArr);
 
$dataArr = array('f_first_name' => $firstName);
 
$dataArr = array('f_first_name' => $firstName);
  
 
// place this within the body tag of the 'thank you' page following email registration.
 
// place this within the body tag of the 'thank you' page following email registration.
echo eV::TEMChannelTag($channel_id,$dataArr);
+
echo eV::TEMChannelTag($channel_id,$email,$dataArr);
  
 
</source>
 
</source>
Line 46: Line 53:
 
// we will need the order array to get necessary data to generate tag
 
// we will need the order array to get necessary data to generate tag
 
$orderArr = eV::orderGetCompleteArray();
 
$orderArr = eV::orderGetCompleteArray();
 +
 +
// get email which is required
 +
$email = eV::orderGetEmail($orderArr);
 +
 
// convert order data into data array that function is expecting
 
// convert order data into data array that function is expecting
 
$dataArr = eV::TEMDataArr_conversion($orderArr);
 
$dataArr = eV::TEMDataArr_conversion($orderArr);
  
 
// get tag
 
// get tag
$tag = eV::TEMChannelTag($channel_id,$dataArr);
+
$tag = eV::TEMChannelTag($channel_id,$email,$dataArr);
 
// output tag
 
// output tag
 
echo $tag;
 
echo $tag;
Line 60: Line 71:
 
:*[[Functions:orderGetCompleteArray|orderGetCompleteArray]]
 
:*[[Functions:orderGetCompleteArray|orderGetCompleteArray]]
 
:*[[Functions:orderGetFirstName|orderGetFirstName]]
 
:*[[Functions:orderGetFirstName|orderGetFirstName]]
 +
:*[[Functions:orderGetEmail|orderGetEmail]]

Latest revision as of 16:43, 30 July 2009

Description

Returns a single pixel img tag that sends data to Trigger Email Marketing via their API specification. The tag will automatically pull and use the clientid and client key as specified in Settings under the eCommerce tab. The tag will also automatically pull the email address using the orderGetEmail function for the passed order data array.

Syntax

$tag = eV::TEMChannelTag($channel_id,$email,[,$dataArr][,$environment=test])

Paramaters

  • $channel_id CHAR REQUIRED
specifies the channel id, as assigned by Trigger Email Marketing.
  • $email CHAR REQUIRED
specifies the email address associated with this trigger. It is recommended to use the orderGetEmail function to retrieve this.
  • $dataArr ARRAY OPTIONAL
keyed array of customer facts, conversion facts, abandoned cart or cart item data. See the TEM API data specification for available fields.
  • $environment CHAR OPTIONAL
dropbox location as assigned by Trigger Email Marketing. Defaults to 'test'.

Return Values

Returns a string containing the complete image tag - ready to be echo'd to the screen. Example value:

<img src=”https://secure.triggeremails.com/public/api/test/tem_eboapi.php?c=123456&ck=567890&e=test@test.com&ch=1234” height=”0” width=”0” border=”0”>

Examples

Newsletter Registration Example
// set the channel id
// this is provided by TEM
$channel_id = "12345";
 
// get order data which will be used to extract email, first name
$orderArr = eV::orderGetCompleteArray();
 
// get email which is required
$email = eV::orderGetEmail($orderArr);
 
// we also want to pass the first name
// this is an optional customer fact
$firstName = eV::orderGetFirstName($orderArr);
$dataArr = array('f_first_name' => $firstName);
 
// place this within the body tag of the 'thank you' page following email registration.
echo eV::TEMChannelTag($channel_id,$email,$dataArr);
Conversion tag following completed order
// set the channel id
// this is provided by TEM
$channel_id = "23456";
 
// we will need the order array to get necessary data to generate tag
$orderArr = eV::orderGetCompleteArray();
 
// get email which is required
$email = eV::orderGetEmail($orderArr);
 
// convert order data into data array that function is expecting
$dataArr = eV::TEMDataArr_conversion($orderArr);
 
// get tag
$tag = eV::TEMChannelTag($channel_id,$email,$dataArr);
// output tag
echo $tag;

See Also