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.


_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.


    eventName:'Select event', 

Custom dimension _setCustomVar #


_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.

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.


    eventName: '購入',
    productId: 123456,
    productCatalog: '商品カテゴリ',
    productName: '商品名',
    productPrice: 123.45,
    createDate: '2018-04-23 15:40:46'

Cross domain settings setCrossDomainLink #


_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.

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 #



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.



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

setVPV #



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.




setURL #

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

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




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

setPVTag #



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
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.


Sample rate setting setSampleRate #


_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.


_pt_sp_2.push('setSampleRate, 1000');

Block ad parameters for visits setIgnoreCampaign #



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 #


_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...