Lasting Impressions for EE v3 and v4

Lasting Impressions for EE v3 and v4

Compatibility

Compatible with EE versions3.0+, 4.0
Lasting Impressions Version4.0.0
Price$25.99
Purchase fromDevot-ee

Overview

This ExpressionEngine module will record the entries viewed by each visitor to your site. You can then re-display each visitor's entries to them using all the same functionality as the standard ExpressionEngine channel:entries tag pair.

This module was originally designed for ecommerce sites to display a "recently viewed products" list to each customer, however it can be used anywhere you need to record and "playback" entries seen by each visitor to your site.

You can track entries from any or all channels and then specify which channel you are interested in when playing them back.

The entries are stored in a cookie for each visitor to your site.

This add-on logs of the dates, times and number of views of each tracked entry which you can re-display to your visitors or use in reports by downloading the data from the EECMS control panel.

Usage

The module consists of three template tags:

{exp:lasting_impressions:register}
This is used to register the id of each entry you want to record.

{exp:lasting_impressions:entries} {/exp:lasting_impressions:entries}
This tag pair is used to display the visited channel entries, previously recorded by the register tag.

{exp:lasting_impressions:form}{/exp:lasting_impressions:form}
This tag is used when you want your visitors to be able to remove items from their "recently viewed" list. See Allowing a visitor to remove items from the list of recently viewed entries.

Installation

  1. Unzip the Lasting Impressions zip archive
  2. Upload the folder /sys/user/addons/lasting_impressions to your site's ExpressionEngine user/addons folder.
  3. Upload the /themes/user/lasting_impressions folder to your themes/user folder.
  4. Log in to the ExpressionEngine CP and navigate to the Add-On Manager
  5. Locate Lasting Impressions in the Third Party Add-Ons list and install it by selecting the "Install" button.

Control Panel

Before you can enter or edit the settings you just make sure that the plug-in is enabled. You do this by navigating to Lasting Impressions in the Third Party Add-Ons list of the Add-On Manager.

Lasting Impressions Control Panel

To start using the add-on, select the "enable" radio button.

The other settings are:

Maximum number of entries to record: specify the maximum number of entries that will be recorded for each visitor. Newer entries will push older ones off the list.

No of days before cookie expires: the entries that a visitor has seen are stored in a cookie. That cookie will exist for the number of days specified here or until the visitor clears their cookies.

Press "Submit" to save your changes.

Reporting

If your Lasting Impressions register tag contains the parameter 
 

enable_reporting="yes"

then Lasting Impressions will record each visit to the channel entries it is set to track.

You can view this data from the control panel by selecting the reports link from the Lasting Impressions Control Panel screen.

There are two available views - All Data and Entry Totals.

The "All Data" view shows every entry recorded by Lasting Impressions for all visitors.

Lasting Impressions Detailed Report

 

The "Entry Totals" view shows a summary of the number of visits to each channel entry:

Lasting Impressions Summary Report

 

You can Export either view as a CSV file by clicking on the "Export as CSV" button.

You can also purge all the data and start again by clicking on the "Purge All Data" button. On a busy site it is important to purge this data regularly otherwise your database may fill up quite quickly.

Template Tags

register

The first thing you'll need to do is register channel entries when they are viewed by a visitor. To do this, add the following tag inside a channel:entries tag pair to track the id of that entry.

{exp:lasting_impressions:register entry_id="{entry_id}"}

Parameters

entry_id

entry_id="123" or
entry_id="{entry_id}"

[Required] You must supply an entry ID, one id at a time. The id can be hard coded or passed in from an enclosing channel entries tag pair.

make_revisits_most_recent

make_revisits_most_recent="yes|no"

Default: "yes"

[Optional] Ensures that on subsequent visits to an entry which has already been recorded, that entry is moved to be the most recent entry in the list. Set this to "no" to keep entries in their original position in the list. You can still output the entries by most recent by setting the display_order parameter of the entries tag to "recent".

enable_reporting

enable_reporting="yes|no"

Default: "no"

[Optional] Set this parameter to "yes" and Lasting Impressions will record every channel entry visited. You can then report on these visits by using the reporting screen (see below). NB: On a busy site the database could fill up quite quickly with data so we recommend regularly exporting the data and then purging.

Displaying Entries

To display the entries to your visitor, use this tag pair:

{exp:lasting_impressions:entries}

... your custom fields and markup go here ...

{/exp:lasting_impressions:entries}

Within this tag pair you may use any of the variables made available by the standard EECMS channel entries tag pair.

N.B. The Lasting Impressions Entries tag pair inherits from the EE Channel Entries tag therefore you must observe the same rules with regard to nesting.  Do not nest the {exp:lasting_impressions_pro:entries} tag pair inside an {exp:channel_entries} tag pair (use an embed or another method if you need the Lasting impressions entries tag to be placed within an ExpressionEngine Channel Entries tag pair).

Although the output of this tag pair is identical to the ExpressionEngine channel entries tag, the parameters are limited to those listed below. You can, however use any of the variables / custom fields that you would normally use in your channel entries loop.

Parameters

  • channel
  • display_order
  • status 
  • channel

channel

channel="shop_products"

[Required] You must specify which channel you require for your results. Without this you will get errors if you choose channel fields that are not global.

display_order

display_order="recent|register"

[Optional] Display the entries by the most recent first (as determined by their time stamp) or the order in which they were registered. Useful when the registered order isn't necessarily in date/time order when make_revisits_most_recent is set to "no". Setting this value to "recent" will ensure a list of entries displayed in the order they were last visited.

status

status="open|latest"

[Optional] Specify the ExpressionEngine channel status of the channel entries you wish to display  The Default is "open". Multiple values are separated by a pipe character.

Variables

Choose any channel field name used by the entries. The returned entries work just like they do in the standard ExpressionEngine channel entries tag. If you are using custom fields then you'll need to make sure that they match the output if you're displaying entries from different channels.

You can also use the Lasting Impressions Utility Tags view_count and last_view tags within this tag pair

Utility Tags

You can quickly retrieve the number of entries currently viewed by a visitor using the count tag anywhere in your templates:

{exp:lasting_impressions:count}

This tag can be useful to see if there are any lasting impressions to display by testing the count within an {if} statement.

There are also two additional tags which can be used both in the entries tag and in the forms tags, and as a bonus you can use them within a standard ExpressionEngine channel entries tag pair as well.

view_count

{lasting_impressions:view_count}

The number of times an entry has been viewed

last_view

{lasting_impressions:last_view format="[date_format]"}

The date and time of the last time each entry was viewed. You can use all the usual EECMS date formatting parameters on this variable.

If you want to use these two variables within a standard channel entries tag then it is best to wrap them in an {if} statement something like this example:

{if "{lasting_impressions:view_count}" > 0}

   Viewed {lasting_impressions:view_count} times

   Last viewed on {lasting_impressions:last_view                    format="%D, %F %d, %Y - %g:%i:%s"}

{/if}

Visitor Management

Enabling a visitor to remove items from the list of recently viewed entries

Lasting Impressions gives you two methods to choose from which enable visitors to remove items from their list of recently viewed entries.  You can wrap each item in a form, submit data and refresh to get the new list or you can use Ajax which will reload the data on the fly.

Posting a form to Remove Entries

Each entry will be wrapped in a form and a visitor will be able to click on a link or a button to remove entries. You can display each entry within this tag in exactly the same way as you would use the Lasting Impressions entries tag pair. All the fields are available to you along with the two additional fields described above.
 

{exp:lasting_impressions:form}

    ... your custom fields and markup go here ...

{exp:lasting_impressions:form}

Parameters

  • channel
  • display_order
  • status
  • submit_value
  • use_html5
  • use_ajax
  • listings_template
  • parent_tag_id

channel

channel="shop_products"

[Required] You must specify which channel you require for your results. Without this you will get errors if you choose channel fields that are not global.

display_order

display_order="recent|register"

[Optional] Display the entries by the most recent first (as determined by their time stamp) or the order in which they were registered. Useful when the registered order isn't necessarily in date/time order when make_revisits_most_recent is set to "no". Setting this value to "recent" will ensure a list of entries displayed in the order they were last visited.

status

status="open|latest"

[Optional] Specify the ExpressionEngine channel status of the channel entries you wish to display  The Default is "open". Multiple values are separated by a pipe character.

submit_value

submit_value="Remove ..."

[Optional] The tag pair will generate either a submit button or an anchor for you to use as the remove link. This is especially useful for the ajax option (below) as it will ensure that each button or link contains the correct css class used by the built-in JavaScript.

This parameter lets you specify what text should be displayed in the resulting markup. If you include either of the submit tags but omit this parameter then the default text "Remove ..." will be used. Of course you're free to use your own link or button.

To instruct the tag pair whether to insert a button or a link you use a {submit_button} or {submit_link} variable.

use_html5

use_html5="yes|no"

[Optional] If the tag pair is generating a submit button for you, should the resulting markup close the tag with a > (html5) or with a />

use_ajax

use_ajax="yes|no"

[Optional] You can submit the form using AJAX by setting this parameter to "yes". If you do this then you must include the supplied AJAX script by using the {exp:lasting_impressions:load_js} tag (see below) and you must also specify the listings_template and parent_tag_id parameters as well.

listings_template

listing_template="template_name"

[Required if use_ajax="yes"] This tells the ajax call which template to use for re-listing the entries once one of them has been removed. See Using Ajax for more information

parent_tag_id

parent_tag_id="parent_tag_id"

[Optional] This tells the AJAX function which containing tag to use to insert the revised listing back into the template. See Using Ajax for more information

Variables

Use any channel field name used by the entries. The returned entries work just like they do in the standard ExpressionEngine channel entries tag.

You can also use the Lasting Impressions Utility Tags view_count and last_view tags within this tag pair

The tag pair will also generate a submit button or link for you, which ensures the correct class parameter is used if you want to use the AJAX functionality. These variables are:
 

{submit_button} 

which will generate an HTML submit button, and
 

{submit_link}

which will generate an HTML anchor tag.

Both will include the css class remove-lasting-impressions which the AJAX JavaScript uses to attach its "click" event to.

Using Ajax

You can enable visitors to remove entries without refreshing the whole page, here's how.

Lasting Impressions Pro comes with some JavaScript that you are free to use.  You load the JavaScript by using this tag on your page:

{exp:lasting_impressions_pro:load_js}

Parameters

load_jquery

load_jquery="true|false"

Default: "true"

Lasting Impressions Pro comes with version 1.10.2 minimized version of JQuery.  If you are already loading JQuery, set this parameter to false to avoid loading conflicting JQuery files however, if you do this then make sure you insert this tag AFTER you reference JQuery in your script tag.

When displaying the list of recently viewed items you will use the form tag (as mentioned earlier) making sure you include the three additional AJAX specific parameters:

use_ajax="yes" 
listings_template="path/to_listing_template"
parent_tag_id="parent_id_of_listings"

Your listings template should just contain the lasting_impressions:form tag (as specified above) which you use to list out all the recorded entries. You can include this in your main page as an {embed} within a containing element the AJAX call will re-load the template and insert it into that containing element (whose id you specified using parent_tag_id) each time an entry is removed.

You tell the AJAX where the containing element is by giving it an id and then entering that id into the parent_tag_id parameter

The listings_template tag must include the fully qualified path to the template as you would use in a standard ExpressionEngine {embed} tag like this:

listing_template="includes/lasting_impressions"

The parent_tag_id contains the id of the containing element for the list of entries, like this (assuming your id is called li-template):

parent_tag_id="li-template"

Here is an example ExpressionEngine template showing a main page and an embedded listing template. First, here's a snippet of markup from the main page:

Your Recently Viewed Products
{embed="shop/lasting_impressions_list"}   


... and here's the contents of the embedded template shop/lasting_impressions_list:

 

{exp:lasting_impressions:form
     channel="products"
     status="open"
     use_ajax="yes"
     listing_template="shop/lasting_impressions_list"
     parent_tag_id="lasting_impressions_ajax"
     submit_value="Remove this entry ..."
     use_html5="yes"                         
     display_order="recent"}


  {title}

    ... any of your custom channel fields ...

    {submit_button}

    Viewed {lasting_impressions_pro:view_count} times

    Last viewed on {lasting_impressions_pro:last_view format="%D,%F %d, %Y - %g:%i:%s"}

{/exp:lasting_impressions:form}

PS: Don't forget to load the Lasting Impressions JavaScript library:

{exp:lasting_impressions:load_js load_jquery="false"}