Purchase complete tracking
We've noticed that some customers click away instantly after they have finished buying things. They don't wait for your purchase complete page to load but move on to the next thing in their life. This, unfortunately, means that our script may not get time to run, so it can't record the purchase, and we could mistakenly think the cart was abandoned.
To ensure that every single purchase complete event is registered and buyers aren't sent cart abandon emails, you can do one of the following:
Add a purchase complete tracking pixel
Include this tracking pixel on the purchase confirmation page of your eCommerce system, replacing:
Your content domain
with the correct domain. To find this, expand the User menu, then go to Settings > System configuration > Custom domains and copy the domain from the Content Serving URL , for example, c8.dycdn.net
Your account id
with your account ID. To get your account ID from Fresh Relevance, expand the Settings menu and copy the Account ID.
Example:
<img src="//[Your content domain]/pc/[Your account id]/?e=[customer's email address]" id="__tms_pc" height="1" width="1" />
<img src="//[Your content domain]/pc/[Your account id]/?e=[customer's email address]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
Mark the purchase complete from the server side
If you want to do this from your server side, you can call Mark a purchase as complete.
Hide the email address in the HTML source
If you don't want the customer's email address to appear in the HTML source of your purchase confirmation page, you can hide it. This requires a little work from the web developers who manage your ecommerce site.
Use an alternative ID
If you have imported either an External ID (eid
) or Customer ID (cid
) into Fresh Relevance then the customer can be identified using this.
To identify the user using the email ID in your ESP, merge this value into the eid=
instead of e=
:
<img src="//[Your content domain]/pc/[Account ID]/?eid=[customer's EID in your ESP]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
Similarly the customer ID can be provided in the cid=
field:
<img src="//[Your content domain]/pc/[Account ID]/?cid=[Customer ID]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
Encoded email
Another method of doing this is to use Base64URL encoding on the email address. This is a form of Base64 encoding that works on URLs. You can try it out with this encoder.
If you need it, there's a spec here.
Once you've created a base64 encoded version of the email address, you can use it in this very slightly different version of the script, using be=
instead of e=
:
<img src="//am.dycdn.net/pc/rg55bjkl/?be=[base64url-encoded version of customer's email address]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
As an example, if you're using Python on your webserver, you can encode the email address like this:
import base64
encoded = base64.b64encode('[[email protected]](mailto:[email protected])')
Encrypted email
Finally, you can also encrypt the email address using the RC4 encryption protocol. To do this, you need to specify a shared secret in Fresh Relevance, use this key to encrypt the address using RC4 and then URLbase64 encode the result. There are some code samples below for this.
To specify the encryption key:
- In Fresh Relevance, expand the User menu and go to Settings > Security and privacy.
- Select RC4 encryption.
- Select CHANGE THE ENCRYPTION KEY.
- Enter a value for the encryption key.
The value can be up to 200 ASCII characters. - Select SAVE.
Code samples - rc4 encryption
<?php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
From https://gist.github.com/2185197
*/
function rc4( $str, $key) {
$s = array();
for ($i = 0; $i < 256; $i++) {
$s[$i] = $i;
}
$j = 0;
for ($i = 0; $i < 256; $i++) {
$j = ($j + $s[$i] + ord($key[$i % strlen($key)])) % 256;
$x = $s[$i];
$s[$i] = $s[$j];
$s[$j] = $x;
}
$i = 0;
$j = 0;
$res = '';
for ($y = 0; $y < strlen($str); $y++) {
$i = ($i + 1) % 256;
$j = ($j + $s[$i]) % 256;
$x = $s[$i];
$s[$i] = $s[$j];
$s[$j] = $x;
$res .= $str[$y] ^ chr($s[($s[$i] + $s[$j]) % 256]);
}
return $res;
}
/* This example shows how to encrypt a value to pass it to Triggered Messaging */
$encrypted = base64_encode(rc4("test","myprivatekey"));
$reversed = rc4( base64_decode($encrypted), "myprivatekey");
echo "Encrypted form in base64:\n";
echo $encrypted;
echo "\nReversed back to plain text:\n";
echo $reversed;
echo "\n";
?>
## {{{ http://code.activestate.com/recipes/576736/ (r5)
#!/usr/bin/env python
#
# RC4, ARC4, ARCFOUR algorithm
#
# Copyright (c) 2009 joonis new media
# Author: Thimo Kraemer <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
def rc4crypt(data, key):
x = 0
box = range(256)
for i in range(256):
x = (x + box[i] + ord(key[i % len(key)])) % 256
box[i], box[x] = box[x], box[i]
x = 0
y = 0
out = []
for char in data:
x = (x + 1) % 256
y = (y + box[x]) % 256
box[x], box[y] = box[y], box[x]
out.append(chr(ord(char) ^ box[(box[x] + box[y]) % 256]))
return ''.join(out)
## end of http://code.activestate.com/recipes/576736/ }}}
# This example shows how to encrypt a value to pass it to Triggered Messaging
import base64
encrypted = base64.b64encode(rc4crypt(data="test", key="myprivatekey"))
reversed = rc4crypt(data=base64.b64decode(encrypted), key="myprivatekey")
print "Encrypted form in base64:"
print encrypted
print "Reversed back to plain text:"
print reversed
You can also make use of our RC4 test page.
To access:
- Expand the User menu and go to Settings > Security and Privacy.
- Select RC4 Encryption.
Once you've added the shared secret to Fresh Relevance and created an RC4 encrypted, URLbase64 encoded version of the email address, you can use it in this very slightly different version of the Purchase Complete Image below (ee=
instead of e=
):
<img src="//am.dycdn.net/pc/rg55bjkl/?ee=[rc4-encrypted-URLbase64-encoded version of customer's email address]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
RSA encryption
If you have the Enterprise module for Fresh Relevance, you can use RSA encryption for mobile apps.
Example
<img src="//[Your content domain]/pc/[Your account id]/?rsae=[customer's email address]&r=[order / reference number]" id="__tms_pc" height="1" width="1" />
Learn more in RSA encryption and Mobile and App API.
Updated 19 days ago