Guide | Creating a New Project

This guide covers the steps required to work with some sample data to create a new project within CJ Path.

Step 1) Acquire sample data

Download sample from a publicly available source onto your local machine. For this guide, we are using the following:

/retail-store-logs-sample-data.zip

Step 2) Unzip data into your working directory

Use any unzipping program you like to unzip and extract all the files into your working directory.

Step 3) Share your local drive to docker containers

Access your docker settings (e.g. -in Windows, right click the Docker icon) and enable sharing your local drive.

Step 4) Start CJ Path docker container and add data volume

Open a shell and enter the following:

docker run -ti -p 80:80 -v /yourlocaldir/retail-store-logs-sample-data:/mydata auriqsystems/cjpath /bin/bash
bash-4.3# bash start_server.sh
bash-4.3# su -s /bin/bash apache
bash-4.3$ ls -l /mydata

Step 5) Copy sample project directory contents into new project directory

We will copy all the files and subdirectories from the sample apache_log project into a new project directory (myproject) which we will customize in subsequent steps.

Enter the following:

bash-4.3$ cd /var/www/html/cjpath/ess
bash-4.3$ cp -r apache_log myproject
bash-4.3$ cd myproject/
bash-4.3$ pwd -- check if your in the right directory 
bash-4.3$ ls -l /mydata -- check if you can see your own data
bash-4.3$ rm –r data -- delete the sample data already in data subdirectory

Step 6) Change name in usrconfig.inc

Change the project name in usrconfig.inc file to the name of your new project.

Just enter

$ vi usrconfig.inc

to open the text editor.  Enter edit mode by selecting “I” key and delete and replace the name.  When you are done, hit “esc” and then type in “:x” to save and quit.

Step 7) Customize setup.sh to find your own data

Use your text editor and add the following lines to your setup.sh script:

ess category add sitecatalyst "/mydata/omnitur*" --overwrite
ess category add product "/mydata/products.tsv" --overwrite
ess category add user "/mydata/users.tsv" –-overwrite

 

Step 8) Run modified setup.sh

Enter the following:

Bash-4.3$ bash setup.sh

 

Step 9) Customize make_cj.sh to process your data

Use your text editor and add the lines highlighted in red to your make_cj.sh script:

#!/bin/bash
####################################################################################
# Import Sitecatalyst log, product and user profile into customer journey database
####### Variables ##################################################################
source "./usrconfig.inc"
source "./usrparam.inc"
Cache="${CACHE}"

OPTION="--thread=1 --debug"
CJ_TABLE_SPEC="s:uid i:t s:src s:domain s:page s:pname s:ref s:skey s:ip s:bwos is:fg s:ent i:visit i:pnum f:score"
####### Functions ##############
import_weblog () {
 if [ ! -f "products.tsv" ]; then
 ess stream product "*" "*" "cat > products.tsv"
 fi
 ess stream sitecatalyst "*" "*" \
 "aq_pp -f,tsv - -d s@2:ts s@8:ip s@13:url s@14:uid s@39:ref s@44:bwos s@50:city s@51:country s@53:state \
 -eval i:t 'DateToTime(ts,\"Y.m.d.H.M.S\")' -eval s:domain url -cmb+1,eok,tsv products.tsv s:url s:pname \
 -map uid '{%%ck%%}' %%ck%% \
 -eval s:src '\"web\"' -imp,ddef udb_cj:cj" $OPTION
}
import_userinfo () {
 ess stream user "*" "*" "aq_pp -f+1,eok,tsv - -d s:uid s:dob s:gender \
 -imp,ddef,nonew udb_cj:member" $OPTION
}

read_cj_from_cache () {
 eval "aq_udb -clr udb_cj"
 ess category add CJ3 "$Cache/cj.csv.gz" --noprobe --overwrite
 ess stream CJ3 "*" "*" "aq_pp -f+1 - -d $CJ_TABLE_SPEC -imp,ddef udb_cj:cj" $OPTION
}
write_cj_to_cache () {
 eval "aq_udb -ord udb_cj:cj"
 eval "aq_udb -exp udb_cj:cj | gzip > $Cache/cj.csv.gz"
}
#
##################################
#### MAIN #######
##################################
bash createdb.sh

#
# Check if cache folder exists
if [ ! -d "$Cache" ]; then
 mkdir -p $Cache
fi
import_weblog
import_userinfo
write_cj_to_cache

 

Step 10) Run make_cj.sh to create customer journey data

Enter the following:

Bash-4.3$ bash make_cj.sh

Note: You may see some warning messages at the end of execution due to some errors in the source data files.  These can be disregarded for the purpose of this guide.

 

Step 11) Customize usrparam.inc file

Use your text editor and copy and paste the following to your usrparam.inc file:

####################################################
# Custom Parameters
####################################################
### Import
CACHE="$CACHEDIR/$NAME"
### Conversions ###################################
CONVERSION="PatCmp(pname,\"*movie*\")”
#### CAL PATH ###
PAT_PAGE="-if -filt 'src==\"web\"' -eval ety pname -endif"
PAT_CV="-if -filt '$CONVERSION' -eval ety '\"CV\"' -endif"
INCFL="-filt 'ety!=\"\"'"
CreateNode="$PAT_PAGE $PAT_CV $INCFL"
PSSTART="" # null= calculate path from the top
PSEND="CV" # Tile CV point
Grouping=""
#
CVDEPTH="profile.days" # default: days

 

Step 12) Run demo.sh to verify changes are correct

Enter the following:

Bash-4.3$ bash demo.sh

When you execute this script, you should see a long list of sample analyses against your project data.

Step 13) Add your project to the UI

Modify the projects array in "app/index.html" to include your project name.

Step 14) Access the UI and verify the new project has been added

Enter http://localhost into your browser and see if your new project is available.

Step 15) Configure Admin settings for your new project

Access the admin menu on the left and select the Data Cache option.

Select your project name and click on the refresh icon to pull your cache file for your data.

Step 16) Add a User Segment and Conversion definition

Enter the following definition to create a user segment of only PC users:

-pp,post=next_key profile -filt 'bwos=="PC"' -goto next_pp -endpp

Enter the following definition to create a conversion goal:

PatCmp(pname,"*movie*")

You can add any number of segments and conversion definitions.  To find out more on about definition syntax, click here.

Step 17) Add Touchpoint definition

Enter the following to create a touchpoint definition for only pages accessed:

-if -filt 'src=="web"' -eval ety '"Page"' -endif

Step 18) Set User Segment and Conversion configurations

Add the user segment and conversion definitions created earlier to user segment and conversion configurations.  Configurations are like groupings, so you can select multiple definitions under a grouping like "By Device", and under that group you can select multiple definitions like "PC, tablet, phone, etc".

Step 19) Access the Customer Journeys report and apply all your changes