Functions:TEMChannelTag

From Whirlwind eCommerce Wiki
Revision as of 16:43, 30 July 2009 by Root (Talk | contribs) (added email attribute)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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