You are on page 1of 21

CJ SITE

INTEGRATION FOR
SAMPLE CLIENT
A GUIDE FOR INTEGRATING
CJ AFFILIATE INTO YOUR
WEBSITE

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2
TABLE OF CONTENTS

Version History 2
Overview 2
Server-Side Tracking of CJ’s Click ID 2
Server-Side Tracking of CJ’s Click ID 3
Content Security Policy 4
Reverse Proxy Configuration 4
Please see the Appendix #1 for examples (Apache, Nginx, Cloudflare, Akamai). 5
Site Tagging – Getting Started 5
Accepting the cjdata URL Parameter 6
Tag for Site Pages 6
Conversion Tag 9
Server To Server (S2S) Tracking 14
Appendix #1: Reverse Proxy Details 19
Reverse Proxy Details 19
Apache 20
Nginx 20
Cloudflare 21
Akamai 21

VERSION HISTORY

Change Date Change Description Change By


2021-10-14 CSP whitelisting VIVnetworks
2022-08-05 Content Security Policy requirements update VIVnetworks

OVERVIEW

The purpose of this document is to help you integrate CJ Affiliate into your site. The CJ tag integration
sets you up for long-term success with CJ Affiliate, enabling tracking of consumer shopping and
purchasing events in a privacy-friendly way. It is the foundation of our commissioning and providing
real-time transparency that enables you to grow your program.

Five Simple Steps to CJ Integration


1. Implement server-side storage for CJ's click ID.
2. Implement Reverse Proxy.
3. Add Page Visit Tags on all pages from the homepage through the shopping cart.
4. Add a Conversion Page Tag on your order confirmation/order complete page.
5. Setup Concurrent Tracking with Inbound Server to Server (S2S)
6. Test that your web pages’ integrity is maintained and the dynamic values you have inserted are
correct in the tag.
Your CJ Client Integration team will ensure that the data is successfully received. Please work with your
Client Integration Engineer to coordinate testing.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

2
SERVER-SIDE TRACKING OF CJ’S CLICK ID

Some modern browsers and devices (Safari, iPhones, iPads, etc.) have third-party cookies disabled by
default, which block cookies unless they originate from the same domain as your site. To solve for this, CJ
will include a URL parameter and value containing a unique click ID on all of your affiliate links. When the
customer lands on your site with this ID you must use a server-side (HTTP) cookie given that first-party
cookies created using a JavaScript method have known tracking limitations due to Apple ITP.
The click ID can appear on all pages of your site except for your confirmation or “Thank You” page.
Landing page URL example:
https://www.example.com?cjevent=656e8fa049ec11ea8237023d0a240612
A new value of the cjevent parameter above will be automatically passed and populated by CJ on each
customer click.

The below attributes of the cookie are required for the tracking solution to work.
● The cookie name must be cje.
● The cookie duration is 13 months. This duration aligns with this solution’s other storage methods.
● The httpOnly attribute must not be set. This ensures the cookie can be read by JavaScript.
● The cje cookie value must be updated anytime the cjevent parameter is seen in the page URL.
● The cookie domain must be the the top level domain (.sampledomain.com)
● The cookie must have the secure attribute set.
● If the cookie needs to be accessed cross-site for your tracking needs, the SameSite attribute
must be set to None.

To set the cje cookie using PHP, add the following script to all pages.
PHP cookie example
<?php
$cookie_name = "cje";
$domain = ".example.com"; // use your domain, for instance ".example.com"
$_GET_lower = array_change_key_case($_GET, CASE_LOWER);
$cjevent = $_GET_lower["cjevent"];
if ($cjevent) {
setcookie($cookie_name, $cjevent, time() + (86400 * 395), "/", $domain, false, false);
}
?>

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

3
SERVER-SIDE TRACKING OF CJ’S CLICK ID

IMPORTANT

Depending on legislation in the target country, it may not be possible to set non-functional/technical
cookies without the user’s prior permission (opt-in). If that is the case, you need to store the click ID on
your server, typically inside a session. This is true for all CZ shops starting 1.1.2022 for example.

In such a case, the session duration needs to be long enough, meaning equal or greater to the referral
period set in the program terms of your affiliate program in CJ. In general 45 days should be enough in
most cases.

Ideally you should use both the server-side storage and cje cookie at the same time. In such a case the
cje cookie should live for the recommended period of 13 months and be used as a backup value if the
server-side storage is not available anymore, while the server-side storage could be used just for a long
enough period of time, e.g. 45 days.

CONTENT SECURITY POLICY

If you have Content Security Policy implemented at your website, you need to whitelist the
following domains.

Policy

Domain img-src worker-src connect-src script-src style-src font-src child-src Purpose

*.mczbf.com x x x x Tracking

*.kdukvh.com x Tracking

*.emjcd.com x Tracking

*.dotomi.com x Tracking

Bookmarklet for
generating affiliate
*.cj.com x x x x links. Used by
publishers.

*.sjwoe.com x Privacy

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

4
REVERSE PROXY CONFIGURATION

Some modern browsers and devices (Safari, iPhones, iPads, etc.) have third-party cookies disabled by
default, which block cookies unless they originate from the same domain as your site. To solve for this,
you will need to implement a reverse proxy to point your web server to a CJ server. This will allow CJ’s
tag to utilize storage solutions (such as a first-party cookie, session storage, and local storage) in your
domain, track customer action conversions, and attribute those conversions to your affiliate partners.
After your reverse proxy is configured and the CJ tags have been placed on your site, CJ tracking will
appear to the browser as originating from your site. Additional details on the reverse proxy are available in
the Appendix.

Setup
You will need to set up a reverse proxy from your own domain to CJ’s servers. The proxy request must
always be secure. The reverse proxy will send requests that start with the following path:
https://www.{DOMAIN}.{DOTCOM}/proxydirectory/
e.g. https://www.example.com/proxydirectory/
And proxy those request back to CJ’s servers:
https://www.mczbf.com/

This documentation uses the directory /proxydirectory/ by default. If there is a reason why the
/proxydirectory/ does not work for your site, please contact your CIE with the desired directory to receive
updated reverse proxy and tagging documentation. When you are ready to test the change, or if you have
further questions regarding this step, please contact your CJ Client Integration Engineer (CIE).
In your proxy configuration, please ensure you are passing the following HTTP headers:
Header Description Notes
X-Forwarded-For Customer's IP address. Required to be IPV4 value.
X-Forwarded-Host Your website's domain. Protocol not required.
Ex: www.yourdomain.com
X-Forwarded-Server Name of the computer/server This will help with troubleshooting in the event multiple servers
the proxied request came are used for the proxy.
from.
X-Forwarded-Request-Host Your website's domain. This is requested in addition to the X-Forwarded-Host in the
event that the request is bounced through multiple hosts.
X-Forwarded-Request-Path Full path of the tag request. This allows CJ to know what the proxy directory is.
The full path is required.
Ex: The full path for a Request to https://
www.{DOMAIN}.{DOTCOM}/proxydirectory/tags/{TAG_ID}/tag.j
s is /proxydirectory/tags/{TAG_ID}/tag.js

Please see the Appendix #1 for examples (Apache, Nginx, Cloudflare, Akamai).

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

5
SITE TAGGING – GETTING STARTED

● CJ distinguishes between two basic types of site tags: page visit tags and conversion page tags.
● CJ needs to have page visit tags placed on all site pages, especially all landing pages, to ensure
accurate tracking and commissioning.

ACCEPTING THE CJDATA URL PARAMETER

As part of CJ’s compliance with the GDPR, we will pass a URL parameter on your landing page called
"cjdata". This parameter will be used to pass through information regarding GDPR consent, so the
Universal Tag can behave in compliance with the regulation. Please ensure you can accept this URL
parameter on all landing pages where an affiliate may drive traffic to your website.
Example landing page: https://www.advertiser.com?cjdata=mx87hgm

TAG FOR SITE PAGES

This section contains example code for your Site Page Tag that will go on all pages of your site that are
not transaction confirmation or purchase confirmation pages. This section also contains the list of required
and optional parameters you can send in your Site Page Tag.
Important notes for configuring your Site Page Tag:
● Place the site tag data near the top of the page, within the opening and closing \ tags with no
visible line breaks.
● The site tag data should be placed before the CJ Tag Script.
● These coding examples are provided as a courtesy and for your reference only. These examples
may not work for your specific shopping cart or web site. CJ does not guarantee the accuracy of
these coding examples.
● Placeholders with brackets denote the location of required values. Brackets are for illustration
purposes only, and should NOT be placed in the actual code.
● The enterpriseId value will be provided to you by a member of CJ’s Client Integration team
● A member of CJ’s Client Integration team will verify the accuracy of your conversion tag
configuration
Page Visit Tag Code
<!-- BEGIN CJ TRACKING CODE -->
<script type='text/javascript'>
if (!window.cj) window.cj = {};

cj.sitePage = {
enterpriseId: CJEnterpriseID,
pageType: '<SEE PAGE TYPE TABLE BELOW>',
userId: '<userId>',
emailHash: '<SHA-256 EMAIL HASH>',
referringChannel: '<referringChannel>',
cartSubtotal: <cartSubtotal>,
items: [
{ 'unitPrice': 9.99, 'itemId': 'M223-02-001', 'quantity': 20, 'discount': 0 },
{ 'unitPrice': 24.99, 'itemId': 'B00138CTNY', 'quantity': 4, 'discount': 1.00 },
{ 'unitPrice': 1449.00, 'itemId': 'MWHA2LL/A', 'quantity': 1, 'discount': 350.00 },
This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

6
]
};
</script>

<script type='text/javascript'>
(function(a,b,c,d){
a='https://www.{DOMAIN}.{DOTCOM}/proxydirectory/tags/TagID/tag.js';
b=document;c='script';d=b.createElement(c);d.src=a;
d.type='text/java'+c;d.async=true;
d.id='cjapitag';
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a)
})();
</script>
<!-- END CJ TRACKING CODE -->

SITE PAGE TAG PARAMETERS


Parameter Type Description
enterpriseId Id This value is set to your CJ Enterprise ID, which is a static value
provided by CJ.
pageType See 'Page Type' table below See 'Page Type' table below for a list of accepted values
userId string Unique user ID you have assigned to the customer (i.e.
membership ID, customer ID). This should not contain any
Personally Identifiable Information
Required for advanced reporting
emailHash string SHA-256 hash of customer’s email address. Remove
leading/trailing spaces and convert email address to lowercase
before hashing.
Required for advanced reporting
referringChannel See list of expected values Marketing channel the user was referred by before arriving to your
site. This value only needs to be populated on the landing page
where the user first arrives to your site.
Expected values:
● Affiliate
● Display
● Social
● Search
● Email
● Direct_Navigation
Required for advanced reporting
cartSubtotal Decimal Subtotal of the shopping cart. This should only be populate when
the user is on a shopping cart page. This should not include taxes
or shipping costs.

items Include all items in the shopping cart. This should only be populate when the user is on a shopping cart
page. This should not include taxes or shipping costs.
itemId Identifier for the item
Additional Requirements:

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

7
● The system supports an alphanumeric string with dashes or
underscores only. Spaces and other characters are not permitted.
● Item ID values must be less than or equal to 100 characters.
unitPrice Amount parameter that corresponds to each individual item in the cart.
Provide a unitPrice parameter equal to that of the Item ID's Unit Price
(amount of one of that item). Do not adjust the amount when the quantity is
greater than one (e.g. do not provide unitPrice: 6.00 for two items at 3.00
each—see quantity below).
Requirements:
● The corresponding value (e.g., 13.49) must be in the format of
numbers, and may have a decimal point. No other characters, such
as dollar signs ("$") or commas (","), are supported by the CJ
system.
quantity Quantity parameter that corresponds to each item in the cart. The quantity
value is multiplied by the unitPrice value to determine the total for a given
item (e.g. quantity 2 of unitPrice 3.00 would result in 6.00 being recorded in
our system).
Requirements:
● The quantity field does not recognize decimal amounts. For
example, quantity=1.0 is read by the system as quantity=10.
discount Optional discount parameter that corresponds to each Item Id in the cart. The
discount value represents the discount applied for the associated item.
The item level discount amount is spread across all items in the series, which
gives you the new individual item amount. That new amount is then multiplied
by the quantity to get the subtotal for that item. (unitPrice -(discount/quantity))
* quantity).
For example, if unitPrice=10, quantity=2 and discount=5 the new amount for
each item is 7.50 and the subtotal for the item would be 15.00.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

8
PAGE TYPE ACCEPTED VALUES
This section contains the accepted values for the pageType parameter in the Site Page Tag and
Conversion Tag. This list is organized by business vertical.

Retail and Network Services


Page Type Notes
homepage
department
category
subCategory
productDetail
cart Pass all items in the cart, if possible. Follow the format outlines in the Site Tag code example
searchResults
storeLocator
accountSignup
accountCenter Any pages within the account center after the user has logged in
conversionConfirmation

Travel
Page Type Notes
homepage
Information
propertyResults
propertyDetails
cart Pass all items in the cart, if possible. Follow the format outlines in the Site Tag code example
searchResults
accountSignup
accountCenter Any pages within the account center after the user has logged in
conversionConfirmation

Finance
Page Type Notes
homepage
department
category
subCategory
productDetail
applicationStart
searchResults
branchLocator
accountSignup
accountCenter Any pages within the account center after the user has logged in
conversionConfirmation

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

9
CONVERSION TAG

This section contains example code for your CJ Conversion Tag that will report transactions that occur on
your website to CJ. This section also contains the list of required and optional parameters you will send in
your conversion tag.
Important notes for configuring your CJ Conversion Tag:
● The conversion tag should only be placed on the conversion complete page and only fire once for
each conversion event.
● Place the conversion tag data near the top of your Thank You or confirmation following the order
or application process, within the opening and closing <body> tags.
● Placeholders with brackets denote the location of required values. Brackets are for illustration
purposes only and should NOT be placed in the actual code.
● Please ensure no Personally identifiable information (PII) is passed in the conversion tag
(including URL).
● The actionTrackerId value(s) for the confirmation page tag(s) are included in the table below.

ACTION TRACKER REFERENCE TABLE


Action Name Action Criteria actionTrackerId
Sample Action Name Sample Action Criteria CJActionID

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

10
Conversion Tag Code
<!-- BEGIN CJ CONVERSION TAG -->

<script type="text/javascript">
if (!window.cj) window.cj = {};

cj.order = {
enterpriseId: 'CJEnterpriseID', // required
pageType: 'conversionConfirmation',
userId: 'userId',
emailHash: '<SHA-256 EMAIL HASH',
orderId: '<ORDERID>', // required
actionTrackerId: 'CJActionID', // required, please see Action Tracker Reference Table
currency: '<CURRENCY>', // required
amount: '<AMOUNT>', // required
discount: '<DISCOUNT>',
coupon: '<COUPON>',
cjeventOrder: '<cje COOKIE VALUE>',
customerCountry: '<CUSTOMERCOUNTRY>',
customerStatus: '<CUSTOMERSTATUS>',
promotion: '<PROMOTION>',
items: [
{ 'unitPrice': '9.99', 'itemId': 'M223-02', 'quantity': '20', 'discount': '0' },
{ 'unitPrice': '24.99', 'itemId': 'B00138C', 'quantity': '4', 'discount': '1.00' },
{ 'unitPrice': '1449.00', 'itemId': 'MWHA', 'quantity': '1', 'discount': '50.00' }
]
};
</script>
<script type='text/javascript'>
(function(a,b,c,d){
a='https://www.{DOMAIN}.{DOTCOM}/proxydirectory/tags/TagID/tag.js';
b=document;c='script';d=b.createElement(c);d.src=a;
d.type='text/java'+c;d.async=true;
d.id='cjapitag';
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a)
})();
</script>

<!-- END CJ CONVERSION TAG -->

Notes on using the example:


● These coding examples are provided as a courtesy and for your reference only. These examples may not
work for your specific shopping cart or website. CJ does not guarantee the accuracy of these coding
examples.
● Third-party checkout processes on a separate domain may require custom coding. Please contact your
Client Integration Engineer to assist with implementation if your site uses one of these services or changes
domains during customer navigation.
● A member of CJ’s Client Integration team will verify the accuracy of your conversion tag configuration.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

11
CONVERSION TAG PROPERTIES
Tag Property Description & Examples Expected Requisite
Format
actionTrackerId This is a static value provided by CJ. action will have a unique Numeric Mandatory
actionTrackerId value.
Example:
actionTrackerId: 'CJActionID',
amount The amount value should not include shipping or tax. CJ assumes the Decimal Mandatory
amount value is in the currency specified in the currency parameter. If
you specify a currency other than your functional currency, the system
converts the amount value to an amount in your functional currency
using a current conversion rate.
cjeventOrder Contains the click ID value stored in the “cje” cookie. See earlier String Mandatory
section SERVER-SIDE TRACKING OF CJ’S CLICK ID

This is required for CJ to attribute the conversion back to the affiliate


partners.
coupon The coupon/voucher code used in the transaction. String Recommende
d where
applicable
currency Identifies the currency used to determine the amount value for the ISO Mandatory
order. This three-letter code is static and can be hard-coded into the Currency
cj.order object. If a code is not specified, product prices display in your Code
functional currency. If a blank value is submitted (“cj.order.currency”,
with no specified value), a transaction error will occur.

For a list of supported currencies and codes, please visit the Support
Center.
discount Discount associated with the order in the currency parameter. Decimal Mandatory
enterpriseId This value is set to your CJ Enterprise ID, which is a static value Numeric Mandatory
provided by CJ.
orderId The orderId is a unique identifier, such as an order identifier or invoice Alphanumeri Mandatory
number, which must be populated for each action. It is used to c
reconcile orders in the your system with CJ in order to validate each
sale or lead.
● This value will be truncated after the 96th character.
● Only alphanumeric characters, dashes, and underscores can
be included in the orderId field.
● CJ prohibits the submission of personally identifiable
information in the orderId field, such as a full or partial email
address.
pageType Should always be 'conversionConfirmation' on transaction/conversion Alphanumeri Mandatory
confirmation pages. c
userId Unique user ID you have assigned to the customer (i.e. membership String Optional
ID, customer ID). This should not contain any Personally Identifiable
Information.
emailHash SHA-256 hash of customer’s email address. Remove leading/trailing String Optional
spaces and convert email address to lowercase before hashing.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

12
ITEM LEVEL DETAILS
Tag Property Description & Examples Expected Requisite
Format
itemId Identifier for the item purchased. Alphanumeri Mandatory
● A maximum of 100 sets of item-based values is supported for c
each order.
● The system supports an alphanumeric string with dashes or
underscores only. Spaces and other characters are not permitted.
● Item SKU values must be less than or equal to 100 characters.
unitPrice Amount parameter that corresponds to each individual item in the Decimal Mandatory
transaction.
● The corresponding value (e.g., 13.49) must be in the format of
numbers, and may have a decimal point. No other characters,
such as dollar signs ("$") or commas (","), are supported by the CJ
system.
● A maximum of 100 sets of item-based values is supported for
each order.
● If the currency parameter is omitted from the tag or if the value is
empty, products default to the program's functional currency.
● The system assumes the unitPrice value is in the currency
specified in the currency parameter. If the tag specifies a currency
other than the functional currency, the system converts the
unitPrice value to an amount in the functional currency using a
current conversion rate.
● Do not adjust the amount when the quantity is greater than one
(e.g. do not provide unitPrice=6.00 for two items at 3.00
each—see quantity below).

quantity Quantity parameter that corresponds to each item in the transaction. The Integer Mandatory
quantity value is multiplied by the unitPrice value to determine the total for a
given item (e.g. quantity 2 of unitPrice 3.00 would result in 6.00 being
recorded in our system).
● A maximum of 100 sets of item-based values is supported for
each order.
● The quantity field does not recognize decimal amounts. For
example, quantity=1.0 is read by the system as quantity=10.
discount Discount parameter that corresponds to each itemId in the transaction. The Decimal Mandatory
discount value represents the discount applied for the associated item. The where
item level discount amount is spread across all items in the series, which applicable
gives you the new individual item amount. That new amount is then
multiplied by the quantity to get the subtotal for that item:

(unitPrice -(discount/quantity)) * quantity)

For example, if unitPrice=10, quantity=2 and discount=5 the new amount for
each item is 7.50 and the subtotal for the item would be 15.00.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

13
ADDITIONAL CONVERSION PARAMETERS
Property in Tag Description & Examples Expected
Format
customerCountry The customer's country (GBR, USA, etc). ISO 3166-1
alpha 3 country
code
customerStatus Indicates customer status based on past purchases (new, lapsed, return). Alphanumeric
promotion Promotion applied. If multiple, must be comma-separated. Alphanumeric

ADDITIONAL NOTES - COMMON ISSUES

● All decimal values need to be positive. Using negative values will lead to an error and orders not being
tracked.
● The values you pass for the parameters need to enable CJ to calculate the final order value after discount
and without VAT based on the following formula in the example below:

[(order.items[0].unitPrice * order.items[0].quantity - order.items[0].discount) +


(order.items[1].unitPrice * order.items[1].quantity - order.items[1].discount) + … +
(order.items[n].unitPrice * order.items[n].quantity - order.items[n].discount)] - order.discount
=
order.amount - order.discount

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

14
SERVER TO SERVER (S2S) TRACKING

Server-to-server tracking ensures that all conversions are being tracked, even in cases where the
client-side tracking would get blocked by an ad blocker or was similarly interfered with by negative
browser behavior. Given the dynamics and ever-changing landscape, this setup provides confidence that
publisher-driven conversions will track even as stricter changes that may impact cookies or site tag
performance.
The following outlines the technical specifications and requirements for sending conversion data to CJ via
the Inbound S2S method. When you determine that a commissionable event has occurred, you will send
a request to the CJ tracking server. Several dynamic values must be inserted into the query string in
addition to static values. Below you will find your unique static identifiers, an example of the S2S call, and
important notes on the parameters.
Important Notes:

● The site must capture and store a query string parameter called "CJEVENT" on the landing page.
This value must be accepted on every landing page of the site and will be an alphanumeric string
of up to 64 characters. The URL parameter name where this value passes can be customized.
● When a CJEVENT value is known at the time of conversion, the call must include this value.
● If the customer uses a payment method, which will redirect him to payment gateway on third party
website, you need to either store the CJEVENT value for this order into your database or send
the S2S postback immeditely when the order is submitted, before the customer leaves your
website. This is needed to prevent missing conversions in situations, when the customer does not
return from the payment gateway, but still completes the order (e.g. by making a payment based
on instructions in an email sent to him).
● Whenever possible, you should send the S2S postback call after the Universal Tag call has
already occurred.
● You will need to populate the ITEMx, AMTx, QTYx sets dynamically, starting with ITEM1, AMT1,
QTY1. ITEM IDs can only contain letters, numbers, dashes, and underscores.
● The value of AMTx will equal the amount of just one item. CJ will multiply AMTx by the Quantity
(QTYx) to get the total amount purchased for a particular item.
● Product SKUs in the call must match the same format and values as product SKUs in the product
catalog (Google Shopping specification).
● You will need to dynamically populate the OID. The OID is the unique Order ID or confirmation
identifier assigned to each transaction. The OID can only contain letters, numbers, dashes, and
underscores.
● Shipping and tax should not be included in the call.
● The order of parameters does not matter are not case-sensitive.
● You may hardcode currency to USD if you are only passing amounts in United States Dollars.
● The tracking URL should be called immediately on order submission, before the customer leaves
the website (e.g. for payment gateway). If the tracking URL is not called immediately on order
submission, you need to ensure that you store the “CJEVENT” value in your database alongside
the order ID at that point. The goal is to prevent possible tracking issues, in cases where the
customer might close the payment gateway or if there occurred some issue due to which the
customer would not reach the order confirmation page.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

15
Inbound S2S Postback Example
Below is an example of a S2S postback example, including all parameters and placeholders. The table
explains how each parameter will need to be populated in your specific tag. Note: Placeholders with
brackets denote the location of required values. Brackets are for illustration purposes only and should
NOT be placed in the actual code.

CJ Specific Parameters:
The highlighted values TYPE, CID and Signature correspond to CJ provided values which are specific
and exclusive to your program. You will find the exact values in the table below. You will need to pass the
corresponding values for each Action.

Action Criteria Action ID (TYPE) Signature CID


1. Sample Action Name Sample Action Criteria CJActionID CJEnterpriseI
D

Order Detail Parameters:


You will need to configure the grey highlighted order detail parameters in the S2S call. Following the
example below is detailed information on the requirements of each parameter.

https://www.emjcd.com/u?CID=CJEnterpriseID&TYPE=CJActionID&METHOD=S2S&SIGNATURE=&CJE
VENT=[INBOUNDVALUE]&eventTime=[eventTime]&OID=[oid]&currency=[currency]&coupon=[couponCo
de]&ITEMx=[ItemSku]&AMTx=[AmountofItem]&QTYx=[Quantity]&DCNTx=[ItemDiscount]&discount=[disc
ountAmount]&customerCountry=[customerCountry]&customerStatus=[customerStatus]&promotion=[prom
otion]

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

16
INBOUND SERVER TO SERVER PROPERTIES
Postback Description & Examples Expected Requisite
Property Format
CID This value is set to your CJ Enterprise ID, which is a static value Numeric Mandatory
provided by CJ.
TYPE This is also called an Action ID in the Account Manager that is a static Numeric Mandatory
value provided by CJ. Each action will have a unique TYPE value.
Your account may have multiple actions, such as a sale and a lead,
and each will be referenced by a different TYPE value. Your specific
value(s) can be found in the "Action" table above.
method Hardcoded value indicating tracking method for Server to Server. Must S2S Mandatory
be set to “S2S” in the Server to Server postback URL.
CJEVENT EXAMPLE: CJEVENT=XBMn0HYfI5Ky3Yt6AU7I

- This value is provided by CJ in a URL parameter on the customer’s


landing page.
- It must be stored and resubmitted in the server to server postback
call.
- The value must be stored for the duration of the action’s referral
period.
- When there is a new link click, a new CJEVENT value will be
provided on the customer’s landing page. This new value must
overwrite the old value.

Required when known in order for the event to register as affiliate


referred

eventTime This value is to state the desired event date in the S2S call query ISO 8601 Mandatory
string.
● If the date comes in malformed, the transaction will error out
with a new error code.
● If the parameter is sent but it is empty, we'll use the data we
received in the S2S call.
● If the eventTime is more than 24 hours in the future, the
transaction will error out.
Format:
● yyyy-mm-ddThh24:mm:ss+/-hh:mm
● year, month, date, time, offset from UTC
● Must be URL encoded

Example:

eventTime=2020-09-14T15%3A53%3A00-07%3A00
OID Unique alphanumeric Order ID for the transaction or event. Alphanumeric Mandatory
● Include only alphanumeric characters, dashes, or
underscores within the OID field. Do not include special
characters or spaces in the OID.
● This value truncates after the 96th character, and is used to
cross-reference your system with CJ’s system to validate
each sale or lead.
● CJ prohibits the submission of personally identifiable
information, such as a full or partial email address, in the
OID value.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

17
currency Currency of the value in the AMTx or AMOUNT parameter. If a blank ISO 4217 Mandatory
value is submitted (“CURRENCY=”, with no specified value), a alpha 3
transaction error will occur. currency code
coupon If a coupon is used, it enables coupon control features and reports Alphanumeric Mandatory
within your CJ account. Passing COUPON allows CJ reporting on
“coupon used” and allows you to control which coupons are
commissionable and which are not.
● This field can only contain letters, numbers, dashes, and
underscores.
● Multiple codes can be passed, separated by commas.
discount Total amount of discount applied to the order. If your site does not Numeric Mandatory
accept discount, you can use DISCOUNT=0 or remove the parameter
from the call. Passing DISCOUNT= without a corresponding value will
cause an error.
amount The amount is the pre-tax, pre-shipping sales amount of the entire Numeric Mandatory
order. If you utilize the DISCOUNT parameter, do not include
discounts applied to an order.
ITEMx Item or product SKU Alphanumeric Mandatory
● An Item ID value must be passed for each item (individual
product, service, lead, etc.) involved in an action and must
have an accompanying QTYx and AMTx.
● The x value in ITEMx must be an integer that follows an
unbroken sequence of ITEM1, ITEM2, etc. to differentiate
each item involved in the action. Do not include "x" in the
parameter name.
● A maximum of 100 sets of item-based values (ITEMx /
AMTx / QTYx) is supported for each order.
● The CJ system supports an alphanumeric string with
dashes or underscores for the Item ID value. Do not include
special characters or spaces.
● Item ID values must be less than or equal to 100
characters.
AMTx The amount is the pre-tax and pre-shipping sales amount for the Numeric Mandatory
corresponding ITEMx.
● The x value in AMTx must be an integer that follows an
unbroken sequence of AMT1, AMT2, etc. to differentiate
each item involved in the action. Do not include "x" in the
parameter name.
● The value must only consist of numbers and a decimal
point. No other characters, such as dollar signs ("$"),
commas (","), or negative signs ("-") are supported.
● The value should not include any shipping or tax, and must
represent the value of one item (the unit price). CJ will
multiply the AMT value by the corresponding QTY value.
● If a particular action will always have a unit price of zero,
you may hard-code a value of 0.
● The system assumes the value is in the currency specified
in the CURRENCY parameter. If you specify a currency
other than your functional currency, our system converts the
value to an amount in your functional currency, using the
current conversion rate.
● If you offer discounts and coupons, but are not using the
DISCOUNT parameter, this value must be the post-discount
unit price.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

18
QTYx Quantity of corresponding items purchased in the ITEMx parameter. Numeric Mandatory
● Do not use a decimal point or comma in the quantity values.
Only positive integer of 1 or greater are supported.
● The x value must be an integer (greater than or equal to 1)
that follows an unbroken sequence of QTY1, QTY2, etc., to
differentiate the quantity for each item. Do not include "x" in
the parameter name.
● A maximum of 100 sets of item-based values (ITEMx /
AMTx / QTYx) is supported for each order.
DCNTx Applies a line item discount to the corresponding AMTx value. Numeric Mandatory
● The x value must be an integer (greater than or equal to 1)
that corresponds with the ITEMx for which the discount is
being applied.
● If you are not passing a discount for a particular item you
must use DCNTx=0 or remove the parameter from the call.

ADDITIONAL CONVERSION PARAMETERS


Property in Tag Description & Examples Expected
Format
cust_country The customer's country (GBR, USA, etc). ISO 3166-1
alpha 3 country
code
cust_status Indicates customer status based on past purchases (new, lapsed, return). Alphanumeric
promotion Promotion applied. If multiple, must be comma-separated. Alphanumeric

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

19
APPENDIX #1: REVERSE PROXY DETAILS

REVERSE PROXY DETAILS


Once the reverse proxy, page visit tags, and conversion page tags are live on your site, each page tag
call will proxy through your web server to the CJ tracking server. CJ will provide the necessary content in
a response.
1. The CJ tags firing in the customer’s browser will make requests to your web server.
2. The reverse proxy will automatically forward the requests to CJ's tracking server.
3. CJ’s server will respond with content to your web server.
4. The reverse proxy will pass the calls back to the customer’s web browser.

Apache
If you are using the Apache httpd server, you can configure the mod_proxy module to proxy to CJ.
Apache Example
# Modules
LoadModule ssl_module modules/mod_ssl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

# Proxy Configuration
SSLProxyEngine on;

RequestHeader add "X-Forwarded-Request-Path" "%{REQUEST_URI}s"


RequestHeader add "X-Forwarded-Request-Host" "%{HTTP_HOST}s"

ProxyPass "/proxydirectory/" "https://www.mczbf.com/"


ProxyPassReverse "/proxydirectory/" "https://www.mczbf.com/"

For more information, see these articles:


● http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#forwardreverse
● https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

20
Nginx
If you are using the NGINX, you can update the following template to proxy to CJ.
NGINX Example
server {
server_name SERVER_HOST_NAME;
location /proxydirectory/ {
proxy_ssl_server_name on;
proxy_pass https://www.mczbf.com/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $server_name;
proxy_set_header X-Forwarded-Request-Host $host;
proxy_set_header X-Forwarded-Request-Path $request_uri;
}
}

For more information, see this article:


● https://docs.nginx.com/nginx/admin-guide/security-controls/securing-http-traffic-upstream/
● https://nginx.org/en/docs/http/ngx_http_proxy_module.html

Cloudflare
You can also configure the reverse proxy in Cloudflare CDN. Refer to the guide available here for details.

Akamai
You can also configure the reverse proxy in Akamai CDN. Refer to the guide available here for details.

This document is intended solely for distribution by CJ Affiliate. Do not copy, distribute or otherwise share.
© 2020 CJ Affiliate. All Rights Reserved. All names and logos are trademarks or registered trademarks of their respective owners.
Rev. 12/8/20

Version 3.2

21

You might also like