Integrating Sift science With WooCommerce

Wondering what is Sift science ? have a look at there website https://siftscience.com/

Wordering what is WooCommerce ? have a look at this page https://wordpress.org/plugins/woocommerce/

Using Sift science with WooCommerce can significantly reduce charge backs but unfortunately at the time of writing this article Sift science don’t have any plugin for WooCommerce. This read will help you integrate Sift science with WooCommerce.

Before we start

You will also need to install Code Snippets plugin for WordPress. You can get the plugin from here https://wordpress.org/plugins/code-snippets/

Code Snippets is an easy, clean and simple way to add code snippets to your site. It removes the need to add custom snippets to your theme theme’s functions.php file.

Little bit of theory

Completely optional if you to read about WordPress’s functions.php file https://codex.wordpress.org/Functions_File_Explained

Lets dive into it.

we will start with Tracking User Activity. https://siftscience.com/resources/guides/chargebacks#js-snippet

Installing JavaScript snippet to track user activity.

save this snippet in a JavaScript file and name it siftsciencesnippet.js and upload it via ftp to the root of your WordPress site and make sure it is accessible through http://yoursite.com/siftsciencesnippet.js

Now login to Sift science and get your javascript snippet key you can find your key under Developer>Api Keys and then look for it in Javascript Snippet Key section.

(1) Find your Javascript snippet key

now insert this snippet key in your java-script snippet

Creating a WordPress Code Snippet and populating _user_id and _session_id

click “Add New” in Snippets Menu and enter the name of your snippet, the WordPress Code snippet and make sure to select radio option “Only run on site front-end”

you can copy the WordPress snippet from the following gist

do not forget to save and activate your WordPress snippet.

If you are having hard time understanding this WordPress snippet leave a Comment I will try to explain it.

At this point if you have followed everything correctly your WooCommerce site should have started sending page views to Sift science.

Next we will send Logout, Login and Create Account Activity to Sift science.

--

--

MS in CS | MS in IS | Start Up Founder |Boomtown Alumni. I am always doing something in the hope that answers will follow.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Naveed Ahmad

MS in CS | MS in IS | Start Up Founder |Boomtown Alumni. I am always doing something in the hope that answers will follow.