Saturday, December 27, 2014

In Case of A Mike Disaster

If I become disabled or dead, you should get the password to my keypass software on my computer from the location we discussed in my home.

Then look up the password/url  to my Amazon AWS account. This gives you access to the entire cloud setup.

All passwords, usernames, and other secret information for the system and various services are inside the keypass file. They are all there and you can search the Keypass database until you find what you are looking for.

ClicFlic Linux Server
HR Avatar Production Server

If a password doesn't work, look up the Default Password entry in Keypass. I use this on inconsequential sites mostly. It may work.


Routine Maintenance Activities


To keep the sites running it is important to perform the following activities:

Using an SCP Client, connect to the ClicFlic EC2 instance as root (get credentials from mike's keypass), go to /backup/dbms and delete old copies of the database backup files.  

The servers should run for some time. 

Reboot - Weekly, or when there is a problem.

Reboot all server instances weekly to deal with memory leaks. No issues have been experienced in some time, but ...

To reboot, you can do one of two things.

Method 1. First (and easiest) log onto the AWS console and go to EC2 -> Instances.  Then for each instance choose the reboot action. This will fully reboot the server.

Method 2: Second (and safest since it shuts down the application server before rebooting) SSH into each server. For ClicFlic and HR Avatar, change directories to /backup/scripts then execute the reboot script by typing /reboot.sh  Wait a minute and it should reboot itself.  For the Discern and CFShare server, simply ssh as root and type shutdown -r 0  which will reboot the server.

All servers except the discern server will come back fully on reboot. For discern you must manually restart the essay programs. To do this you must log on to the discern server via SSH as ec2-user (DO NOT LOG ON AS ROOT FOR THIS), then change directory to /work, then execute the script startdiscern.sh by typing /startdiscern.sh  That's it. Just log off after you type that and it should say "OK"

Remove old database records - Weekly

Using WinSCP, connect to the ClicFlic server and navigate to /backup/dbms - delete files over a week old. Should be handled automatically by a script called cleanlogs.sh in /backup/scripts and copied to /etc/cron.daily

Remove old export directories - Weekly

Via http://www.clicflic.com/stutil, go to Clean old Media Files and click on "Clear Local Export Folders."

Clean up some dbms records - Weekly

Via http://www.clicflic.com/stutil, go to "Video and ActX Conversions" and click on "Clean Act Archive Records."  Then click on "Clean Old File Conversion Job Records."

Clean out old deploy folders - Weekly

Via http://www.clicflic.com/stutil, go to Clean old Media Files and click on the button under "Clean Standalone Deploy Directories"  The code for this is "forlake"

Clean out old IMO Media - Quarterly

Via http://www.clicflic.com/stutil, go to Clean old Media Files and click on the button under "Delete Media From Old, Deleted Scripts"  The code for this is "forlake"

Archive ActHistory Records on ClicFlic - Quarterly 
Log on to http://www.clicflic.com using an admin logon and go to Admin -> Archive ActHistory Records.

Archive Test Event records on HR Avatar - Quarterly

Go to http://www.simajob.com and log on using an admin logon. Then go to Admin -> clean/archive to start the process. 

Review IMO Media and delete extraneous files - Annual

Via http://www.clicflic.com/stutil, go to Clean old Media Files and click on the button under "Clean Old/Unused Media Files"  The code for this is "forlake"  Leave actId at 0 to review all IMOs.

Tuesday, December 23, 2014

Campaigns

AD CAMPAIGNS ON HR AVATAR

There are several mechanisms built into HR Avatar to help capture and track information about the source of a particular kind of action by a user. All of these ultimately add a UserAction record, described below.

Custom Page Servlet

A custom page is configured on SimBuilder and is set up to allow non-programmers to create basic marketing content on the HR Avatar website.

All of these pages are accessed through the custom page servlet, https://www.hravatar.com/ta/cpg

The custom page servlet (called AdUtils in the code) generates this page on the fly every time someone accesses it. You can create as many Custom Pages as you want.

Whenever a custom page is accessed, it generates a UserAction record (see below).

Note that all the custom page servlet does is create a  customized web page when someone clicks the URL.

You can embed any form you want inside a custom page. If you want to embed a new account registration form you can code it yourself (to use the campaign servlet below) or embed an iframe like this:  <iframe src="https://www.hravatar.com/ta/misc/custom/regforminsert.xhtml" style="width:600px;height:520px;border:0px;"></iframe>.

Many custom pages will include forms or links that use the campaign servlet to effect an action if the user clicks on the right thing.

Example: To Link to custom page 7 (see it by clicking the link below or modify it on http://sim.hravatar.com) from a search engine, use link:

https://www.hravatar.com/ta/cpg/7/hr-avatar-employment-tests-accurate-easy-to-use-just-40ea-get-a-free-trial

Note that there is no campaign id, the number of the custom page is the unique identifier. It's stored as Custom Page: 7.  This would appear in an account registration that came from this page, unless a custom form is used and it goes through the campaign servlet, in which case you can define your own campaign id.

Campaign Servlet

Sometimes you want to create a custom form with full control of the look/feel and/or have it be hosted off of hravatar.com. But when the form (or link) is clicked, you want to trigger a specific action on HR Avatar, or you just want to create a link that causes HR Avatar to take some action. This is where you would use the Campaign Servlet functionality, described below. Basically, you configure a page to send a set of parameters to HR Avatar when the form is submitted and HR Avatar does the rest, or you create a link that has the appropriate parameters.

Whenever the Campaign Servlet is accessed, it generates a UserAction record with the type defined by the parameter uat and the optional campaign id defined by parameter cpid.

Trackable Actions

In some cases, the system automatically tracks actions, such as blog and news views, or product views. If there is a campaign id in these requests (parameter name=c) then that is stored along with the action in a User Action record.

User Actions

UserActions are created by various parts of the system when key actions are taken by a user, such as searching the catalog, viewing a product, viewing a blog or news entry, or signing up for a new account.

In the database there is a table called UserAction. This table is used to record the actions of anonymous and logged on users.

The following User Action Types are captured:

   SEARCH_PRODUCTS(1,"Product Search"),
    SEARCH_BLOG(2,"Product Blog"),
    SEARCH_NEWS(3,"Product News"),
    DOWNLOAD_WP(10,"Download White Paper" ),
    NEWSLETTER_SIGNUP(11,"Signup for Newsletter" ),
    VIEW_PROMOTION(12,"View Promotion" ),
    VISIT_WEBPAGE(13,"Visit a Misc Webpage" ),
    VIEW_BLOG(14,"View Blog Entry"),
    VIEW_NEWS(15,"View News Entry"),
    VIEW_PRODUCT(16,"View Product Detail" ),
    REGISTER_ACCOUNT(17,"Register for Account" )


The UserAction record captures several key fields:

TypeId:  The numeric type from the list above.
IP:           The IP Address
Referer: The Page that referred the person to the link that caused a UserAction to be recorded.
Identifier: The specific campaign id, if any, passed within the link.

Viewing User Actions

If you want to capture user actions to track which button, which campaign etc, you can do that now and then look on Simajob.com for the results in the Admin area in the section called User Actions.

Coding User Actions

Links within the HR Avatar website will automatically create UserActions using default values.

When you set up a campaign, you can configure the links and buttons to cause your own UserActions as follows:

Method 1: Linking to Blog entries, News entries, and Product Detail pages:

In some cases, you can embed a campaign id by including the http parameter 'c' in the URL. The value for 'c' must be URL-encoded for it to be valid.

Example:

If you want to link to the page:  https://www.hravatar.com/ta/blogs/25/how-to-hire-smart-people with a campaign id of 'my first campaign'

First, url encode my first campaign into:   my+first+campaign

Next, attach the c parameter to the URL as follows:

https://www.hravatar.com/ta/blogs/25/how-to-hire-smart-people?c=my+first+campaign

That's it!  Works for Blog Entries, News Entries, and Product Detail pages.

Method 2: Use the Campaign Servlet

With this method, instead of linking directly to a page, you link to the campaign servlet on HR Avatar with the appropriate parameters. The Campaign servlet creates a useraction record (if data is present for a useraction record), performs any other duties (like registering for a email list), then forwards to the correct page.  So, the Campaign Servlet acts like an intermediary to record where the person came from and what they are doing, for reporting purposes.

We will add to this as different use cases arise.

Basic Process

1. Determine the 'click' url you want to send someone when they click on a link.

2. Assign a campaign id (string, no spaces, numbers and letters only please). Bill or Shoa - recommend you create a Google Doc to track campaign ids.

3. Determine the URL and parameters you want to embed.

4. Embed.

USE CASES

USE CASE 1: Refer to another page.

URL:  https://www.hravatar.com/ta/cpn/

Parameters:
   cpid    Campaign ID (string, no spaces, digits and letters only)
   tgt      fully qualified url of the page to link to, URL Encoded if you use GET (URL Encode Strings at http://www.freeformatter.com/url-encoder.html. Note if this is linking from one page on hravatar website to another, you don't need the https://www.hravatar.com part, just start with /ta/...  like, /ta/user/freetrial.xhtml )
   uat     13
   fn       First Name (Optional)
   ln       Last Name (Optional)
   em     Email (Optional)
   cn      Company Name (Optional)
   ttl       Title (Optional)
   pho    Office Phone (Optional)
   phm    Mobile Phone (Optional)
   uref    User External Reference Id (Advanced, Optional)

Example:

https://www.hravatar.com/ta/cpn/?cpid=campaignnumberone&uat=13&tgt=http%3A%2F%2Fwww.freeformatter.com%2Furl-encoder.html

Notes:

This can forward to any page, on our site or not on our site. You can do a lot with this. 
If user info is provided, such as through a form, a user record is created (or looked up) and saved, and the recorded user action is saved. Be sure the 'name' attribute of each field is exactly equal to the above. These values ARE CASE SENSITIVE.

USE CASE 2: Newsletter Signup

URL:  https://www.hravatar.com/ta/cpn/

Parameters:
   cpid    Campaign ID (string, no spaces, digits and letters only)
   int1    Email List Id Number (from Simajob)
   uat     11
   fn       First Name
   ln       Last Name
   em     Email
   cn      Company Name (Optional)
   ttl       Title (Optional)
   pho    Office Phone (Optional)
   phm    Mobile Phone (Optional)
   uref    User External Reference Id (Advanced, Optional)
   tgt       Target Page, URL Encoded if you use GET ( URL Encode Strings at http://www.freeformatter.com/url-encoder.html), (Optional, will send to home page if not present). Note that this is optional. If not provided, a default page will be used.

Example, use a form with POST or GET and embed hidden parameters for cpid, int1, and uat. Use form fields for fn, ln, em, and optional parameters. Be sure the 'name' attribute of each field is exactly equal to the above. These values ARE CASE SENSITIVE.

USE CASE 3:  White Paper Download

URL:  https://www.hravatar.com/ta/cpn/

Parameters:
   cpid    Campaign ID (string, no spaces, digits and letters only)
   uat     10
   tgt       download URL for white paper, URL Encoded if you use GET ( URL Encode Strings at http://www.freeformatter.com/url-encoder.html)
   tgt2       Target Page for to show a thank you, URL Encoded if you use GET. If this is not provided the system will use a default page.
  str1     The title of the White Paper (URL Encode if you use GET)
int1        Email List Id Number (from Sim Builder, if you want to also register them for an email list)
   fn       First Name
   ln       Last Name
   em     Email
   cn      Company Name (Optional)
   ttl       Title (Optional)
   pho    Office Phone (Optional)
   phm    Mobile Phone (Optional)
   uref    User External Reference Id (Advanced, Optional)

Example, use a form with POST or GET and embed hidden parameters for cpid, int1, and uat. Use form fields for fn, ln, em, and optional parameters.  Be sure the 'name' attribute of each field is exactly equal to the above. These values ARE CASE SENSITIVE.

USE CASE 4:  New Account Signup

URL:  https://www.hravatar.com/ta/cpn/

Parameters:
   cpid    Campaign ID (string, no spaces, digits and letters only)
   int1    0 or missing means has not agreed to terms and conditions. 1 means has reviewed terms. 
   uat     17
   fn       First Name   ln       Last Name
   em     Email
   cn      Company Name (Optional)
   ttl       Title (Optional)
   pho    Office Phone (Optional)
   phm    Mobile Phone (Optional)
   uref    User External Reference Id (Advanced, Optional)

For the FORM element, set the action to: https://www.hravatar.com/ta/cpn/
Set method to POST (can be GET if you need that). Add hidden tags for uat and cpid. 

Example, use a form with POST embed hidden parameters for cpid, and uat. Use form fields for fn, ln, em, and optional parameters.  Be sure the 'name' attribute of each field is exactly equal to the above. These values ARE CASE SENSITIVE.

In this case, if there is a valid email, firstname, and lastname present, the system will register the user for an HR Avatar account. If company name is not provided, the company name will be "Free Trial: [Lastname]."  A Username will be generated from the email by removing everything past the @ sign. A random password will be generated and the user will asked to change password after the first time he logs on.

If insufficient data is present (fn, ln, em) the system will populate all fields and send to the HR Avatar reg form with error message and with the appropriate fields filled in.

USE CASE 5: Link to a new account signup page from a search engine or outside the HR Avatar website (user is not on our website). 

This is just a special case of Use Case 1. To go to the Free Trial signup page and retain the campaign id:

URL:  https://www.hravatar.com/ta/cpn/?cpid=CAMPAIGNID&uat=13&tgt=https%3A%2F%2Fwww.hravatar.com%2Fta%2Fuser%2Ffreetrial.xhtml