Install the conversion tracking code
Nick Hemenway avatar
Written by Nick Hemenway
Updated over a week ago

Note If you are using a supported platform, the conversion tracking code is automatically installed.

In order to earn the Shopper Identity Protection and Issue-Free Orders certifications, you’ll first need to install the conversion tracking code.

To install the conversion tracking code, add the following code to your purchase confirmation page, filling out the bracketed content with the real values.

class="trustedsite-track-conversion" //required
data-orderid="1234" //required
data-email="" //required for automatic opt-in method only
data-country="US" //two letter codes, see eg
data-state="CA" //two letter codes, see eg
data-ifodays="20" //integer denoting whole days before the email will be sent

In the example above, values that are not marked as required are optional. For the service to work properly, you'll need to provide at least the order ID.

The data-ifodays is an optional argument that can be given when including conversion.js which specifies the number of days before the order’s Issue-Free Orders email should be sent. If not set, the email will be sent after 7 days by default.

Including the optional values (other than ifodays) means that the forms for non-automatic opt-ins will have the values pre-filled in for the user, improving the user experience.

While the exact procedure may vary depending on your site's infrastructure, you can use the two examples below as a general guidance for how to customize the code:

Ruby example:

data-type="purchase" data-orderid="<%= current_user.last_order_id %>"
data-email="<%= %>"
data-firstname="<%= current_user.first_name %>"
data-lastname="<%= current_user.last_name %>"

PHP Example:

data-type="purchase" data-orderid="<?php current_user.last_order_id ?>"
data-email="<?php ?>"
data-firstname="<?php current_user.first_name ?>"
data-lastname="<?php current_user.last_name ?>"

After installing the code, you will need to select a customer opt-in method in order to enable Shopper Identity Protection and Issue-Free Orders. To do this:

  1. Log in to your account.

  2. If you have multiple sites in your account, click the one you want to manage.

  3. From the site overview page, click Set Up then Conversion Tracking.

  4. Copy and paste the code to your purchase confirmation page, and replace the bracketed content with real values.

  5. Select an opt-in method for Shopper Identity Protection from the dropdown menu.

Once you have the conversion tracking code installed and you have made some sales, you can begin tracking purchases from the Overview page in your TrustedSite dashboard.

Did this answer your question?