jQuery Smart Engage plugin v1.0.1

Introduction

PushCall offers a jQuery plugin for easy integration of the PushCall SmartEngage functionality in your existing HTML document.

Figure 1 - SmartEngage panel in default PushCall skin. Locale in English.

Figure 1 - SmartEngage panel in default PushCall skin. Locale in English.

Loading the PushCall SmartEngage jQuery plugin

The PushCall jQuery plugin is loaded in conjunction with the jQuery library. It requires v1.6.4 of jQuery or higher to function properly. A typical use of jQuery and the PushCall plugin looks as described in Example code 1.

 

 

See Example code 2 for a very basic example of adding the PushCall CallMeNow client to an HTML page.

 

 

 

If you are using an older version of jQuery and are not able to upgrade to v1.6.4 or higher you can use jQuery’s “noConflict” mode as described in Example code 3

 

(warning)  Remember to use the pc$ variable in conjunction with calls to PushCall functionality when using the no-conflict mode

(warning) If your site requires the use of assets (scripts, images, etc.) that are hosted on a location with SSL support , use the https equivalent of above URL’s. The PushCall jQuery plugin is hosted on a CDN that supports both http and https requests.

 

Embedding the PushCall client: $.smartengage([settings])

Adds the SmartEngage  panel to the HTML page.

Parameters

Optional parameters

Parameter name

Type

Value

Default

animation

String

  • “slide” for slide up/down effect
  • “fade” for fade in/out effect

“slide”

context

object

This object will be made the context of the event callbacks.

undefined

eventCallback

function

Method to call when an event occurs. Also see chapter Events.

undefined

popup

object

Structure with the settings for the popup that will be displayed when user accepts. Possible settings are:

  • “url”. URL of the page to show in popup
  • “width”. The width of the popover in pixels
  • “height”. The height of the popover in pixels
  • “bindOn”[1]. A jQuery object which to bind the click event on. When a click event is triggered on this object the overlay is opened.

{ url: ‘about:blank’,

width: 800,

height:400}

position

String

Position of the engage popup window. Possible values:

  • bottomright
  • bottomleft

bottomright

margin

Integer

Margin in pixels to the nearest page border

20

locale

String

Locale ID used for localization of the text messages

Leave empty for auto detection based on browser language.

Example: “nl” for Dutch

empty

skin

String

URL of the css document to load containing the skin for the smart engage popup and the popover

Default skin location

engageDelay

Integer

The time in seconds before the engage popup is displayed .

0

cooldownPeriod

Integer

The time in seconds the popup will not be displayed to the page vistor once the visitor has closed or declined.

0

userMessages

Object

Structure with additional or alternative texts to use in the engage popup. By default Enlish, German and Dutch translations are available. See example below for available labels.

 


[1] Available since v1.0.1

Example 1

 

 

 

Example 2 – using bindOn

Available since v1.0.1

 

 

 

 

 

Events

The events thrown by the eventCallback mechanism can e.g. be used to notify trackers – like Google Analytics – to track the use of the PushCall services. By using this functionality you can use your online tracking service of choice (as long as it can be used in javascript)

Defining a listener

By defining a callback function (aka event listener) in javascript and passing this function in the settings, it will receive event notifications of any of the relevant state changes.

First step is to define the eventCallback function.

 

 

The event parameter is a string. The eventData is an object containing relevant data based on the event thrown. See tables below for more information on the possible states and data passed in the eventData object.

Using a tracker

By listening to a specific state – like “show” or “click” – it’s possible to track shows/usage of the PushCall SmartEngage functionality with your tracker service of choice. E.g. Google Analytics.

Example:

 

 NB. Note the calls to _gaq.push which trigger the Google Analytics code to track the events.

Possible values for event parameter

Event

eventData

description

show

language, delay

This event is fired when the SmartEngage panel is shown to the user.

click

action

This event is fired when the initializing is complete and the required data is loaded.

 

Data in the eventData parameter

Name

Type

Description

language

String

The locale used

delay

integer

The time in seconds before the SmartEngae panel was shown after document completed loading

action

String

The action took by the user (accept, decline, close_overlay, open). See Actions table below

Actions

Name

Description

accept

The user clicked the “accept” button in the SmartEngage popup

decline

The user clicked the “decline” button in the SmartEngage popup

close_overlay

The user closed the overlay by clicking on the close button or outside the overlay area

open[1]

The user clicked a link that was bind to which triggers opening the overlay.



[1] Available since v1.0.1 

 

Skinning

The plugin features the option to skin it according to your needs. First of all there’s an option to change the text in de labels through the “userMessages” parameter. If you want to change the colors or other elements of the graphic appearance you can provide an alternate CSS file.

UserMessages

By defining  your custom texts through the userMessages parameter you can change the default text labels or add an extra language. By default the SmartEngage plugin comes in English and Dutch.

There are 3 labels:

  • CAPTION
  • BUTTON_ACCEPT
  • BUTTON_DECLINE

The current value of the labels is:

Label

Englilsh

Dutch

CAPTION

Can we help you?

Kunnen we u helpen?

BUTTON_ACCEPT

Yes, please.

Ja, graag.

BUTTON_DECLINE

No, thank you.

Nee, bedankt.

Example - Creating custom button values

CSS Skin

The SmartEngage plugin loads a default stylesheet (CSS) b y default. To change it you can use the skin parameter to provide a URL to a location of a CSS file.