Title: Tracking Code for cj.com (on WooCommerce checkout)
Author: Russell
Published: <strong>Igbe 12, 2018</strong>
Last modified: Òkúdù 23, 2023

---

Ṣàwárí àwọn plugin

![](https://ps.w.org/code-for-cj-affiliate-network/assets/banner-772x250.png?rev
=2096893)

Plugin yìí **kò tíì ṣe àyẹ̀wò pẹ̀lú àwọn ìtújáde mẹ́ta pàtàkì tó kẹ́yìn ti WordPress**.
Ó lè jẹ́ pé a kò tọ́jú tàbí ṣe àtìlẹ́yìn fún un mọ́, ó sì lè ní àwọn ọ̀ràn ìbámu
nígbà tí a bá lò ó pẹ̀lú àwọn ẹ̀yà WordPress tuntun.

![](https://ps.w.org/code-for-cj-affiliate-network/assets/icon-256x256.png?rev=2096893)

# Tracking Code for cj.com (on WooCommerce checkout)

 Láti ọwọ́ [Russell](https://profiles.wordpress.org/russelljamison/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/code-for-cj-affiliate-network.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/#reviews)
 *  [Ìgbéwọlẹ̀](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/#installation)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/)

## Àpèjúwe

CJ Affiliate (previously Commision Junction) is an affiliate service that can bring
money and customers to your website. Learn more at [cj.com](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/cj.com?output_format=md).

This plugin sends the necessary data to participate in the CJ Affiliate network.
Tracks WooCommerce activity and successful Gravity Forms submission.

_WooCommerce or Gravity Forms is required,_ if you want the tracking code added 
to a different plugin, I can explain to your developer what they need to do to code
this up. You may create an issue to track new integrations at [the github repo](https://github.com/Hosting-Utilities/cj.com-wordpress-plugin/issues).

## Àwọn àwòrán ìbòjú

[⌊The settings page. Once filled out, the cj.com tracking code will be added to 
the thank you page of each order placed.⌉⌊The settings page. Once filled out, the
cj.com tracking code will be added to the thank you page of each order placed.⌉[

The settings page. Once filled out, the cj.com tracking code will be added to the
thank you page of each order placed.

## Ìgbéwọlẹ̀

1) Add the plugin through the ‘Plugins’ menu in WordPress

2) When prompted, activate the plugin

3) Go to _Settings > CJ Tracking Code_

4) Enter in your account info

5) The tracking data will then be sent for WooCommerce customers, and on successful
Gravity Form submissions. Supports [WooCommerce 3.0+](https://wordpress.org/plugins/woocommerce/#installation),
and [Gravity Forms 2.4+](https://www.gravityforms.com/)

**Extending the Plugin**

The following filter is available for extending the plugin

    ```
    cj_settings
    ```

This filter allows you to conditionally determine what the CID, type, and tag ID
should be. This is useful when you have want to use multiple tag IDs and types.

Basic Example:

    ```
    add_filter('cj_settings', function($account_data, $submission_method, $order){

        // make changes to $account_data here

        return $account_data;
    }, 10, 3);
    ```

Example 2:

    ```
    add_filter('cj_settings', function($settings, $submission_method, $order_or_form_data, $order_or_form_id){

        // make changes to the settings here
        // Note: return false if you don't want to send any data to CJ for this transaction

        return $settings;
    }, 10, 4);
    ```

The first parameter is an array containing all of the settings to filter. More settings
may be added later, but the array currently holds:

 * ‘enterprise_id’ Ìtumọ̀ Yorùbá: – the enterprise ID
 * ‘action_tracker_id’ Ìtumọ̀ Yorùbá: – the action tracker id
 * ‘tag_id’ Ìtumọ̀ Yorùbá: – no longer used
 * ‘cid’ Ìtumọ̀ Yorùbá: – no longer used
 * ‘type’ Ìtumọ̀ Yorùbá: – no longer used
 * ‘notate_urls’ Ìtumọ̀ Yorùbá: – no longer used
 * ‘notate_order_data’ Ìtumọ̀ Yorùbá: – should we add additional info to order notes(
   on supported integrations)
 * ‘other_params’ Ìtumọ̀ Yorùbá: – Not currently used. If ever used again it will
   contain additional items to submit to CJ. These will appear in the CJ dashboard.
 * ‘storage_mechanism’ Ìtumọ̀ Yorùbá: – Either ‘woo_session’ or ‘cookies’. Both 
   options work. There is normally no need to change this.

The second parameter will be either “woocommerce” or “gravity_forms” depending on
which one initiated everything (more integrations will be added later as theyÌtumọ̀
Yorùbá: ’re requested).

Based on the above parameter the next 2 will either be the form data and form id
or the order data and order id.

If you need me to add additional filters, please open up a new issue at https://
github.com/Hosting-Utilities/cj.com-wordpress-plugin/issues.

## Àwọn àgbéyẹ̀wò

![](https://secure.gravatar.com/avatar/ad55d645cafce7138617fb8c2995a6e4ab32e352d245459674a2bb0d982c7dd9?
s=60&d=retro&r=g)

### 󠀁[Works Awesome For Gravity Forms](https://wordpress.org/support/topic/works-awesome-for-gravity-forms/)󠁿

 [mikhail1234](https://profiles.wordpress.org/mikhail1234/) Òkúdù 27, 2020

I started using this a few days ago for gravity forms and there were a few slight
issues. I contacted Russell, the developer for this plugin, and he was so quick 
to communicate over email and make some adjustments for the plugin to make it work
as needed! I have never received such quick support and quick updates to the plugin
to make it work. 5 stars to Russell and the WP Overwatch team

![](https://secure.gravatar.com/avatar/ba7a2e002929cdf7ebb379a031add7d1ca2d99ca9512ddec0387aad35b0dd4fc?
s=60&d=retro&r=g)

### 󠀁[Just what I needed](https://wordpress.org/support/topic/just-what-i-needed-888/)󠁿

 [rruggles](https://profiles.wordpress.org/rruggles/) Agẹmọ 29, 2019

CJ did not want to take the time to write an integration for WooCommerce (used by
2 Million plus websites), but thankfully Russell at WP Overwatch did. If the CJ 
Technical integration team tells you to develop custom code in order for their tracking
code to work, then you need this plugin. Just install, then add your Tag ID, CID,
and Type. DONE! Worked for me and CJ confirmed all the order details are passing
thru. Thank you for making this plugin available.

![](https://secure.gravatar.com/avatar/b58ebd3dbf093bf367a5d1aaf0f770ece3cb8a47ef747ad44b9cc56ec5086966?
s=60&d=retro&r=g)

### 󠀁[Works with WP 4.9.8](https://wordpress.org/support/topic/works-with-wp-4-9-8/)󠁿

 [Russell](https://profiles.wordpress.org/russelljamison/) Ògún 17, 2018

WeÌtumọ̀ Yorùbá: ’re currently using it on WordPress 4.9.8

 [ Ka gbogbo àwọn àgbéyẹ̀wò 3 ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/)

## Àwọn Olùkópa & Olùgbéejáde

“Tracking Code for cj.com (on WooCommerce checkout)” jẹ́ ètò ìṣàmúlò orísun ṣíṣí
sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa sí plugin yìí.

Àwọn Olùkópa

 *   [ Russell ](https://profiles.wordpress.org/russelljamison/)

[Túmọ̀ “Tracking Code for cj.com (on WooCommerce checkout)” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/code-for-cj-affiliate-network)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/code-for-cj-affiliate-network/),
ṣàyẹ̀wò [ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/code-for-cj-affiliate-network/),
tàbí ṣe àgbékalẹ̀ sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/code-for-cj-affiliate-network/)
nípasẹ̀ [RSS](https://plugins.trac.wordpress.org/log/code-for-cj-affiliate-network/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

#### version 3.3

 * Add server side cookie implementation
 * Allow you to choose which implementation you would like to use. See the settings
   page for more info on the different implementations.
 * Fix bug where in certain circumstances it was trying to set the cookie based 
   on the value of the cje GET parameter instead of the cjevent parameter
 * Added the cj_cookie_duration filter
 * DonÌtumọ̀ Yorùbá: ’t return the amount to CJ as it is no longer required, thanks@
   brittonk for the fix
 * DonÌtumọ̀ Yorùbá: ’t add notes to WooCommerce orders saying an order came from
   a CJ referral when it didnÌtumọ̀ Yorùbá: ’t
 * The “Turn on all available integrations” toggle switch can be disabled now
 * Added an expiremntal option for better compatability with Gravity Forms. When
   selected an alternate method will be used to send data to CJ that wonÌtumọ̀ Yorùbá:’
   t require breaking the ability for Gravity Forms to redirect users after a form
   is submitted
 * WordPress 6 compatibility

#### version 3.2

Add tag ID

#### version 3.1

Fix a problem in 3.0 that was breaking all Ajax requests until the cj settings were
saved

#### version 3.0

THIS CHANGE BREAKS BACKWARDS COMPATIBILITY.
 CJ has new documentation they have 
been handing out that is completely different from what they have online. This update
follows the new documentation, introduces new fields that will need to be filled
out on the settings page, and is an all around overhaul of how the tracking code
is implemented. This version has been verified with the lead client integration 
engineer at CJ to be in compliance with their systems. All users will need to recertify
themselves with the new system.

#### version 2.12

Allow Google Tag Manager and other scripts to read the cjevent cookie (HttpOnly=
false)
 Always use non-www version of domain in cookies Remove extraneous CSS in
the settings page Remove “Did not recieve a PublisherID” notice from WooCommerce
notes. CJ no longer seems to use a publisher ID (but if you do still have a setup
that uses them, they will still be recorded). On the settings page add inline CSS
to make sure the summary elements dropdowns arrows always appear. Add method=IMG
to the conversion tag URL. Let me know if CJ is asking you to use a different tracking
method and I can add support for it.

#### version 2.11

Make the cookie storage mechanism work with caching plugins
 And make it the default
storage mechanism Add a setting to change the duration of the cjevent cookie Add
a settings link on the plugin page The contact form now outputs some of the debug
info into a nice table instead of using var_dumps Display a warning when WPFC_CACHE_QUERYSTRING
is true (from the fastest cache plugin), and makes it easier to add compatibility
features/warnings in the future Minor textual changes to the settings page

#### version 2.10

Puts the plugin in conformance with CJÌtumọ̀ Yorùbá: ’s new rules on what characters
are allowed in item names
 In WordPress 5.5+ the plugin will only send data to CJ
in production environments (the environment is determined by the wp_get_environment_type
function) Gravity Form Integration fixes: * The setting to limit which forms are
used wasnÌtumọ̀ Yorùbá: ’t saving * It was sending a CJ Event of 1 instead of the
actual CJ Event * Decimal numbers were being ignored when calculating the coupon
discount * It wasnÌtumọ̀ Yorùbá: ’t telling you which checkbox/radio button were
selected before

#### version 2.9

More bug fixes for the Gravity Forms integration
 The gravity Forms integration 
should no longer be using the form ID for the item name. Previously it was used 
on unfilled out fields and radio fields.

#### version 2.8

Gravity Forms integration changes:
 * Stop reporting fields that were not filled
in * Add support for the Gravity Forms coupon add-on * Fixes some items that were
not getting reported correctly * Add a note to form entries of the CJ URL used

WooCommerce Integration changes:
 * Compatibility with WooCommerce product bundles
plugin

Settings page changes:
 * Hide WooCommerce or Gravity Form options when the plugin
is not enabled * Send additional information when submitting a ticket (plugin versions,
multisite info) * Replace some checkboxes with toggle switches * Add “Remove Plugin
Data” button * Other misc improvements

#### version 2.7

Add fix to trigger WooCommerce Sessions on non-WooCommerce pages (for storing the
publisherCID and cjevent).
 Change the duration of cookies in the Gravity Forms 
integration to 120 days. When the cookie storage mechanism was used, the publishercid
was not getting retreived.

#### version 2.6

Add cj_account_info filter, for cases where the account info needs to change depending
on what is being purchased

#### version 2.5

Add contact us form and add mention of Hosting Utilities (my new suite of tools 
for managing WordPress sites).

#### version 2.4

Makes cookies last for 120 days when using cookie storage instead of the default
storage mechanism (CJ requires the cookies to last for 120 days).

#### version 2.3

Fixes a security issue where the cjevent was not being properly escaped.
 Also, 
this update adds an alternate storage mechanism to aid in debugging problems.

#### version 2.2

Allow CJ tracking codes to be turned off for gravity forms or WooCommerce. Previously
the tracking code was always added if the associated plugin was enabled.
 Also fixes
sending additional query parameter to CJ. I donÌtumọ̀ Yorùbá: ’t think that feature
was ever actually working. Fixing unit tests

#### version 2.1

Fixing a fatal bug. The endswith function was never defined causing issues.

#### version 2.0

Adding Gravity Forms support

#### version 1.4.0

The item name is now set to SKU code if present, otherwise, the product title is
used
 Grabbing the cjevent is now a case-insensitive process

#### version 1.3.0

Added support for additional currencies. Thanks to [kennyhunter16](https://wordpress.org/support/users/kennyhunter16/),
the currency is now detected from the order that was placed.

#### version 1.2.0

cj.com added some new required fields. This update brings the plugin into conformation
with their documentation at https://developers.cj.com/docs/tracking-integration/
advanced-integration

#### version 1.1.0

Orders that originated from cj.com are now marked as such in the order notes

#### version 1.0.0

Initial commit

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **3.3**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọdún 3 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **10+**
 *  Ẹ̀yà WordPress ** 4.9.9 tàbí ju bẹ́ẹ̀ lọ **
 *  Dánwò dé **6.2.9**
 *  Ẹ̀yà PHP ** 5.6 tàbí ju bẹ́ẹ̀ lọ **
 *  Èdè
 * [English (US)](https://wordpress.org/plugins/code-for-cj-affiliate-network/)
 * Àwọn àmì
 * [advertising](https://yor.wordpress.org/plugins/tags/advertising/)[affiliate](https://yor.wordpress.org/plugins/tags/affiliate/)
   [affiliate marketing](https://yor.wordpress.org/plugins/tags/affiliate-marketing/)
   [cj](https://yor.wordpress.org/plugins/tags/cj/)[commision junction](https://yor.wordpress.org/plugins/tags/commision-junction/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/code-for-cj-affiliate-network/advanced/)

## Àwọn ìbò

 5 lára àwọn ìràwọ̀ 5.

 *  [  3 5-star reviews     ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/reviews/)

## Àwọn Olùkópa

 *   [ Russell ](https://profiles.wordpress.org/russelljamison/)

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/code-for-cj-affiliate-network/)