The clickToConnectSave()
function is a JavaScript call that is located on each page of your customer-facing site. The function persists both order and token information in Commerce Service Center. The JavaScriptCallBack
rule looks for the clickToConnectSave
function on your page, and controls when to run it. The clickToConnectSave
function is created automatically when you run page instrumentation and does not need to be added manually to every page. However, the clickToConnectSave
function can also be configured using the Webcare Rule Builder tool.
Creating the JavaScriptCallback Rule
When you create the JavaScriptCallback
rule, modify the following fields. Other fields can remain at their default values. For additional information on the fields, refer to the Webcare documentation.
Log into Webcare.
Note: In order to log into Webcare, you must have an existing account.
From the Setup menu, select Rule Builder.
Click the Add a New Rule link.
Use the Name field to create the name of the rule. Enter
JavaScriptCallback
.The Applies To field should be set to Customers Only using the pull down menu.
Enable the rule by clicking the Yes radio button in the Enabled field.
Set the Rule Operating Hours to All Hours to ensure that the rule is always run.
Set the Link to Show field to No Link, as this rule will not display a link.
Using the URL Match field, enter a regular expression to indicate to which URL the rule applies. To ensure that the rule applies to all URLs on your site, select the use check box and enter
.*
in the text field.The
JavaScriptCallback
rule is aRunJavaScript
Rule Type. This rule runs the specified JavaScript. SelectRunJavaScript
from the drop down menu.Click the Show Advanced Feature button to display the arguments that are required when using the
RunJavaScript
rule type.In the Argument 1 field, enter the name of the function to be called with its associated parameters. Enter
clicktToConnectSave()
.Ensure that Argument 2 field is set to use the default, which is 0. This argument will run the function whenever the link is clicked.
Save the rule.
This configures the following rule:
Name: JavascriptCallback
Order Run: 0
Applies To: Customers only
Enabled: Yes
URL match (Use): .*
Rule Type: RunJavascript
Argument 1: clickToConnectSave()
Argument 2: 0
For the JavaScriptCallback
rule to run, you must enable CoBrowsing
:
Log into Webcare.
Note: In order to log into Webcare, you must have an existing account.
From the Setup menu, select Rule Builder.
Click the Add a New Rule link.
Use the Name field to create the name of the rule. Enter
CoBrowse
.The Applies To field should be set to Customers Only using the pull down menu.
Enable the rule by clicking the Yes radio button in the Enabled field.
Set the Rule Operating Hours to All Hours to ensure that the rule is always run.
Set the Link to Show field to No Link, as this rule will not display a link.
Using the URL Match field, enter a regular expression to indicate to which URL the rule applies. To ensure that the rule applies to all URLs on your site, select the use check box and enter
.*
in the text field.The
CoBrowse
rule is aCoBrowse
Rule Type. SelectCoBrowse
from the drop down menu.Click the Show Advanced Feature button to display the arguments that are required when using the
CoBrowse
rule type.In the Argument 1 field, enter the name of the function to be called with its associated parameters. Enter
1
Ensure that Argument 2 field is set to use the default, which is 0. This argument will run the function whenever the link is clicked.
Save the rule.
This configures the following rule:
Name: CoBrowse
Applies To: Customers only
Enabled: Yes
URL Match (use): .*
Rule Type: CoBrowse
Argument 1: 1
Argument 2: 0
Once you have created these two rules, you need to set up a rule that passes the call token through Click to Call’s data passing system:
Log into Webcare.
Note: In order to log into Webcare, you must have an existing account.
From the Setup menu, select Rule Builder.
Click the Add a New Rule link.
Use the Name field to create the name of the rule. Enter
ATGClicktoCallToken
.The Applies To field should be set to Customers Only using the pull down menu.
Enable the rule by clicking the Yes radio button in the Enabled field.
Set the Rule Operating Hours to All Hours to ensure that the rule is always run.
Set the Link to Show field to No Link, as this rule will not display a link.
Using the URL Match field, enter a regular expression to indicate to which URL the rule applies. To ensure that the rule applies to all URLs on your site, select the use check box and enter
.*
in the text field.This rule is a
VarFieldMatch
Rule Type. SelectVarFieldMatch
from the drop down menu.Click the Show Advanced Feature button to display the arguments that are required when using the
VarFieldMatch
rule type.In the Argument 1 field, enter the name of the function to be called with its associated parameters. Enter
_atg_call_token.
Set the Argument 2 field to
\s*
. This argument will run the function whenever the link is clicked.Set the Argument 4 field to
1
.Save the rule.
This configures the following rule:
Name: AtgEstaraToken
Applies to: Customers only
Enabled: Yes
URL Match (use): .*
Rule Type: VarFieldMatch
Argument 1: _atg_estara_call_token
Argument 2: \s*
Argument 4: 1