Ön a következő verzió súgóját látja::

The SiteCatalyst framework determines the information that is tracked with SiteCatalyst. To customize the default framework, you use javascript to add custom tracking, integrate SiteCatalyst plugins, and change general settings within the framework used for tracking.

About the Generated javascript for Frameworks

When a page is associated with a SiteCatalyst framework, and the page includes references to the Analytics module, a analytics.sitecatalyst.js file is automatically generated for the page. 

The javascript in the page creates an s_gi object (that the s_code.js SiteCatalyst library defines) and assigns values to its properties. The name of the object instance is s. The code examples that are presented in this section makes several references to this s variable. 

The following example code is similar to the code in an analytics.sitecatalyst.js file:

var s_account = "my_sitecatalyst_account";
var s = s_gi(s_account);
s.fpCookieDomainPeriods = "3";
s.currencyCode= 'USD';
s.trackInlineStats= true;
s.linkTrackVars= 'None';
s.charSet= 'UTF-8';
s.linkLeaveQueryString= false;
s.linkExternalFilters= '';
s.linkTrackEvents= 'None';
s.trackExternalLinks= true;
s.linkDownloadFileTypes= 'exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls';
s.linkInternalFilters= 'javascript:,'+window.location.hostname;
s.trackDownloadLinks= true;
        
s.visitorNamespace = "mynamespace";
s.trackingServer = "xxxxxxx.net";
s.trackingServerSecure = "xxxxxxx.net";

/* Plugin Config */
/*
s.usePlugins=false;
function s_doPlugins(s) {
    //add your custom plugin code here
}
s.doPlugins=s_doPlugins;
*/

When you use custom javascript code to customize the framework, you alter the content of this file.

Configuring SiteCatalyst Properties

There are a number of predefined variables within SiteCatalyst that are configurable on a framework. The charset, cookieLifetime, currencyCode and trackInlineStats variables are included in the General SiteCatalyst Settings list by default.

chlimage_1

You can add variable names and values to the list. These predefined variables and any variables that you add are used to configure the properties of the s object in the analytics.sitecatalyst.js file. The following example shows how the added prop10 property of value CONSTANT is represented in the javascript code:

var s_account = "my_sitecatalyst_account";
var s = s_gi(s_account);
s.fpCookieDomainPeriods = "3";
s.currencyCode= 'USD';
s.trackInlineStats= true;
s.linkTrackVars= 'None';
s.charSet= 'UTF-8';
s.linkLeaveQueryString= false;
s.linkExternalFilters= '';
s.linkTrackEvents= 'None';
s.trackExternalLinks= true;
s.linkDownloadFileTypes= 'exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls';
s.prop10= 'CONSTANT';
s.linkInternalFilters= 'javascript:,'+window.location.hostname;
s.trackDownloadLinks= true;
        
s.visitorNamespace = "mynamespace";
s.trackingServer = "xxxxxxx.net";
s.trackingServerSecure = "xxxxxxx.net";

Use the following procedure to add variables to the list:

  1. On your SiteCatalyst framework page, expand the General SiteCatalyst Settings area.
  2. Below the list of variables, click Add Item to add a new variable to the list.
  3. In the left-hand cell, enter a name for the variable, for example prop10.
  4. In the right-hand column, enter a value for the variable, for example CONSTANT.
  5. To remove a variable, click the (-) button next to the variable.

Megjegyzés:

When entering variables and values, make sure they are correctly formatted and spelled, or the calls will not be sent with the correct value/variable pair. Misspelled variables and values can even prevent calls from occurring.

Consult with your SiteCatalyst representative to make sure these variables are correctly set.

Figyelmeztetés:

Some of the variables in this list are mandatory in order for SiteCatalyst calls to function correctly, (e.g.  currencyCode, charSet)

So, even if they are removed from the framework itself, they will still be attached with a default value when the SiteCatalyst call is made.

Adding custom javascript to a SiteCatalyst Framework

The free-from javascript box in the General SiteCatalyst Settings area enables you to add custom code to a SiteCatalyst framework. 

chlimage_1

The code that you add is appended to the analytics.sitecatalyst.js file. Therefore, you can access the s variable, which is an instance of the s_gi javascript object that is defined in s_code.js. For example, adding the following code is equivalent to adding a variable named prop10 of value CONSTANT, which is the example in the previous section:

s.prop10= 'CONSTANT';

The code in the analytics.sitecatalyst.js file (which includes the content of the SiteCatalyst s_code.js file) contains the following code:

if (s.usePlugins) s.doPlugins(s)

The following procedure demonstrates how to use the javascript box to customize SiteCatalyst tracking.  If your javascript needs to use SiteCatalyst plugins, integrate them into AEM.

  1. Add the following javascript code to the box so that s.doPlugins is executed:

    s.usePlugins=true;
    function s_doPlugins(s) {
        //add your custom code here
    }
    s.doPlugins=s_doPlugins;

    Figyelmeztetés:

    This code is necessary if you want to send variables in a SiteCatalyst call that have been customized in some way that cannot be done through the basic drag&drop interface OR through inline javascript in SiteCatalyst View.

    If the custom variables are outside of the s_doPlugins function they will be sent as undefined in the SiteCatalyst call

  2. Add your javascript code in the s_doPlugins function.

The following example concatenates the data captured on a page in hierarchical order, using a common separator of “|”.

A SiteCatalyst framework has the following configruations:

  • The prop2 SiteCatalyst vaiable is mapped to the pagedata.sitesection site property.
  • The prop3 SiteCatalyst vaiable is mapped to the pagedata.subsection site property.
  • The following code is added to the free-from javascript box:

    s.usePlugins=true;
    function s_doPlugins(s) {
    s.prop1 = s.prop2+'|'+s.prop3;
    }
    s.doPlugins=s_doPlugins;

  • When the webpage that uses the framework is visited (or, in edit mode the page is reloaded or previewed), the calls to SiteCatalyst are performed.

For the http://localhost:4402/cf#/content/geometrixx-outdoors/en/men.html page, the following values are generated in SiteCatalyst:

Adding Global Custom Code for All SiteCatalyst Frameworks

Provide custom javascript code that is integrated into all SiteCatalyst frameworks. When a page's SiteCatalyst framework contains no custom free-form javascript, the javascript that the /libs/cq/analytics/components/sitecatalyst/config.js.jsp script generates is appended to the analytics.sitecatalyst.js file. By default, the script has no effect because it is commented out. The code also sets s.usePlugins to false

/* Plugin Config */
/*
s.usePlugins=false;
function s_doPlugins(s) {
    //add your custom plugin code here
}
s.doPlugins=s_doPlugins;
*/

Code in the analytics.sitecatalyst.js file (which includes the content of the SiteCatalyst s_code.js file) contains the following code:

if (s.usePlugins) s.doPlugins(s)

Therefore, your javascript should set s.usePlugins to true so that any code in the s_doPlugins function is executed. To customize the code, overlay the config.js.jsp file with one that uses your own javascript. If your javascript needs to use SiteCatalyst plugins, integrate them into AEM.

Megjegyzés:

Do not edit the /libs/cq/analytics/components/sitecatalyst/config.js.jsp file. Certain AEM upgrade or maintenance tasks can re-install the original file, removing your changes.

  1. In CRXDE Lite, create the /apps/cq/analytics/components folder structure:

    1. Right-click the /apps folder and click Create > Create Folder.
    2. Specify cq as the folder name, and click OK.
    3. Similarly, create the analytics and components folders.
  2. Right-click the components folder that you just created and click Create > Create Component. Specify the following property values:

    • Label: sitecatalyst
    • Title: sitecatalyst
    • Super Type: /libs/cq/analytics/components/sitecatalyst
    • Group: hidden
  3. Click Next repeatedly until the OK button is enabled, and then click OK.

    The sitecatalyst component contains the automatically-created sitecatalyst.jsp file.

  4. Right-click the sitecatalyst.jsp file and click Delete.

  5. Right-click the sitecatalyst component and click Create > Create File. Specify the name config.js.jsp and then click OK.

    The config.js.jsp file opens automatically for editing.

  6. Add the following text to the file, and then click Save All:

    <%@page session="true"%>
    /* Plugin Config */
    s.usePlugins=true;
    function s_doPlugins(s) {
        //add your custom plugin code here
    }
    s.doPlugins=s_doPlugins;

    The javascript code that the /apps/cq/analytics/components/sitecatalyst/config.js.jsp script generates is now inserted into the analytics.sitecatalyst.js file for all pages that use a SiteCatalyst framework.

  7. Add the javascript code that you want to execute in the s_doPlugins function, and then click Save All.

Figyelmeztetés:

If any text is present in the free-form javascript of a page's framework (even only whitespace), config.js.jsp is ignored. 

Using SiteCatalyst Plugins in AEM

Obtain the javascript code for SiteCatalyst plugins and integrate them into your SiteCatalyst framework in AEM. Add the code to a client library folder of the category sitecatalyst.plugins so that they are available to your custom javascript code.

For example, if you integrate the getQueryParams plugin, you can call the plugin from the s_doPlugins function of your custom javascript. The following example code sends the query string in "pid" from the referrer's URL as eVar1, when a SiteCatalyst call is triggered.

s.usePlugins=true;
function s_doPlugins(s) {
   // take the query string from the referrer
   s.eVar1=s.getQueryParam('pid','',document.referrer); 
}
s.doPlugins=s_doPlugins;

AEM installs the following SiteCatalyst plugins, so that they are available by default:

  • getQueryParam()
  • getPreviousValue()
  • split()

The /etc/clientlibs/foundation/sitecatalyst/plugins client library folder includes these plugins in the sitecatalyst.plugins category.

Megjegyzés:

Create a new client library folder for your plugins. Do not add plugins to the /etc/clientlibs/foundation/sitecatalyst/plugins folder. This practice ensures that your contribution to the sitecatalyst.plugins category are not overwritten during AEM re-installs or upgrade tasks.

Use the following procedure to create the client library folder for your plugins. You only need to peform this procedure once. To add a plugin to the client library folder, use the subsequent procedure.

  1. In a web browser, open CRXDE Lite. (http://localhost:4502/crx/de)

  2. Right-click the /etc/clientlibs/foundation/sitecatalyst folder and click Create > Create Node. Enter the following property values and then click OK:

    • Name: A name for your client library folder, such as my-plugins
    • Type: cq:ClientLibraryFolder
  3. Select the client library folder that you just created and use the bottom right-hand property bar to add the following property:

    • Name: categories
    • Type: String
    • Value: sitecatalyst.plugins
    • Multi: selected

    Click OK in the Edit window to confirm the property value.

  4. Right-click the client library folder that you just created and click Create > Create File. For the file name type js.txt, and then click OK.

  5. Click Save All.

Use the following procedure to obtain the plugin code, store the code in the AEM repository, and add the code to your client library folder.  

  1. Log in to sc.omniture.com using your SiteCatalyst account.

  2. On the landing page go to Help > Help Home.

  3. In the table of contents on the left side, click Implementation Plug-ins.

  4. Click the link to the plugin that you want to add and when the page opens, locate the javascript source code for the plugin, then select the code and copy it.

  5. Right-click your client library folder, and click Create > Create File. For the file name, type the name of the plugin that you are integrating followed by .js, and then click OK. For example, if you are integrating the getQueryParam plugin, name the file getQueryParam.js.

    When you create the file, it opens for editing.

  6. Paste the plugin javascript code into the file, click Save All, and then close the file.

  7. Open the js.txt file from your client library folder.

  8. In a new line, add the name of the file that contains the plugin, for example getQueryParam.js. Then, click Save All and close the file.

Megjegyzés:

When using plugins, make sure to integrate any supporting plugins as well, otherwise the plugin javascript will not recognize the calls that it makes to the functions in the supporting plugin. For example, the getPreviousValue() plugin requires the split() plugin to function correctly.

The name of the support plugin needs to be added to js.txt as well.

 

Ez a munka a Creative Commons Nevezd meg!-Ne add el!-Így add tovább! 3.0 Unported licenc alatt lett közzétéve.  A Twitter™ és Facebook közzétételeket a Creative Commons jogi feltételei nem szabályozzák.

Jogi közlemények   |   Online adatvédelmi nyilatkozat