API Docs

Custom event settings - setCustomEvent #

Function: Every time it is applied, the number of events can be transferred and behavior data such as button click, registration completion, and shopping cart can be measured. You can set and obtain data based on the logic required for your business. As an example, when measuring the number of registrations, you can set the custom event code in the success function expression of ajax and proceed with the measurement.

Code:

_pt_sp_2.push('setCustomEvent',{ eventName:'NAME', isActiveElement:Interactive_element})

Parameter eventName: Event name, String type, fixed character string selection required.
Parameters isActiveElement: Whether it is an interactive element, Number, selectable, 1: interactive element, 0: non-interactive element. The initial value is 0.

Sample:

_pt_sp_2.push('setCustomEvent',{ 
    eventName:'Select event', 
    isActiveElement:1
})

Custom dimension _setCustomVar #

Sode:

_pt_sp_2.push('setCustomVarV2',{eventName: 'variables'}) 

Sample: You can add custom variables in your code after setting the event. For example, you can measure the type of product and the price of the product for the event "Add to shopping cart". The variables are "type of items in the shopping cart" and "price of items in the shopping cart". This function can be used by using a special plan or by connecting with Datadeck.

Parameter:
Make sure to select setCustomVarV2 because it has a fixed value. The second parameter is in JSON format. Second parameter {key: value}: No data is collected Key: Adds up to 10 values. In the figure, 4 are set, and 6 can be set.

Key (property name): Uses a combination of numbers, letters and underscores. No data will be collected if any other characters are used. If you add a duplicate key, it will be overwritten.

Value (property value): Data type: There are 4 types: string, int, float, and date. If you use any other data type, no data will be collected. The length limits for various data type values ​​are as follows:

String: No data longer than 50 characters will be collected.

Integer (int): (-2147483648,2147483647), If you use an integer outside this range, no data will be collected.

Float: (-4294967296, 4294967294), data will not be collected using floating point numbers outside this range.

Date: The time format must be "YYYY-MM-DD HH: MM: SS". If the format is incorrect, no data will be collected.

Code:

_pt_sp_2.push('setCustomVarV2',{
    eventName: '購入',
    productId: 123456,
    productCatalog: '商品カテゴリ',
    productName: '商品名',
    productPrice: 123.45,
    createDate: '2018-04-23 15:40:46'
})

Cross domain settings setCrossDomainLink #

format:

_pt_sp_2.push('setCrossDomainLink,allManual/halfManual '); 

Function: Cooperation by cross domain setting. Even if the same measurement code is installed in the A domain and the B domain, if the user moves the domain from the A domain to the B domain, the number of visits will be divided because the cookie cannot be shared, and the correct data will be collected. You will be hindered. To coordinate visits, you can use this feature to associate visits. The principle of this API is to collect system visit data by taking cookie information and using it as link point information of href tag attribute. If the move from the website is not a tag href method, this function cannot be used.

Parameter:
allManual Enters all manual mode. Add the onclick = "pt_domain" attribute inside the a tag that needs to perform cross-domain processing. If the user has already set the onclick event (eg onclick = "test ()"), you can add pt_domain to the end (eg onclick = "test (); pt_domain"). If there is no a tag for this attribute, it will not be processed across domains.

halfManual goes into semi-manual mode. Cross-domain processing is applied to all a tags in the page without modifying the a tags.

Setting page title setVPT #

Format

_pt_sp_2.push('setVPT,Title'); 

Function: Set Title. If the page does not have a title tag, it will be displayed as not set on Ptengine, but to eliminate such a case, you can use this function and set the page title manually.

Format

_pt_sp_2.push('setVPT,ptmind'); 

Page source title: ptengine
After using setVPT, you can see it in Ptengine title: ptmind

setVPV #

Format:

_pt_sp_2.push('setVPV,URL');

Function: You can set the demo url. Note: When using this feature, the URL is automatically put in lowercase, so if the URL contains uppercase letters, it may be affected.

Sample

_pt_sp_2.push('setVPV,http://www.google.com/your'); 

URL:http://www.google.com
setVPV:http://www.google.com/your

setURL #

Format _pt_sp_2.push('setURL,#');

Function Set the information after the "#" in the url.

Sample

_pt_sp_2.push('setURL,btnSave'); 

URL:http://www.google.com

URL displayed by Ptengine after using setURL:http://www.google.com#btnSave

setPVTag #

Code

_pt_sp_2.push('setPVTag,URL/#Name,replace'); 

Function: It is a function to send the PV data folder once. You can demo pv the URL conversion of a website that consists of a single page application. If the page hasn't actually moved, but the URL and page content have changed, you can use this function to generate a demo URL and apply all subsequent data to the new URL.

Parameter 1: If parameter 2 (replace) is not set, this value will be the same as the information of # that must be added in the original URL. The generated demo URL will be (original URL + # location information).

If parameter 2 is set to replace, this value will be the full URL after the change. The generated demo URL will be the new URL newly set with this value.

Parameter 2: replace

Sample 1
URL:http://www.ptengine.com
Demo URL you want to generate http://www.ptengine.com#login
n this case, the following function is required.
_pt_sp_2.push ('setPVTag, login');

Sample 2
URL: http://www.ptengine.com
Demo URL you want to generate: http://www.ptengine.com/login

In this case, the following function is required.

_pt_sp_2.push('setPVTag,http://www.ptengine.com/login,replace');

Sample rate setting setSampleRate #

format:

_pt_sp_2.push('setSampleRate, LABEL'); 

Function: Set the sample rate of the collected data. If your website visit data is too large and you don't want to collect all of it, you can set a sample rate to control your data measurement.

Parameter 1: Sample rate setting, must be selected. Example: If set to 1000, the displayed sample rate will be 1/1000, and only 10 visit data out of 10,000 pageviews will be used.

Example:

_pt_sp_2.push('setSampleRate, 1000');

Block ad parameters for visits setIgnoreCampaign #

Code

_pt_sp_2.push('setIgnoreCampaign,true'); 

Features: The data collection system automatically displays the page containing the ad parameters as the entrance page for new visits, so even if you reload all the time, each reload will be counted as the entrance page for new visits. I will.

Parameter: If this is true, the ad (utm) parameter will be ignored and the ad parameter will not generate a new number of visits. If false, the ad (utm) parameter will not be ignored and each visit will be a page containing the ad parameter and will be counted as a new visit.

Event measurement function in iframe on setIframe #

Code

_pt_sp_2.push('setIframe, true'); 

Function: Open the event measurement function in the iframe

Parameter: If this is true, the event measurement function in the iframe will be turned on, and if it is not true, it will not be turned on. In the basic settings, the event continuation function in the iframe is turned off.

Was this article helpful?

  • Yes, great!
  • Not really

Thanks for your feedback.

  Sorry about that. Do you mind sharing how we can improve?

    Write your feedback here...