First you have to inject our integration script into your website.
The Prefixbox integration script should be added to the <head> section of the website, and it should be part of all pages (including product pages).
The script is the following:
<!-- Prefixbox Integration -->
<script>
window.prefixboxAnalytics=window.prefixboxAnalytics||function(t,s,p,o){(window.pfbxQueue=window.pfbxQueue||[]).push({type:t,source:s,params:p,overrideObject:o});};
window.prefixboxFunctions=window.prefixboxFunctions||{}; window.prefixboxCustomerFunctions=window.prefixboxCustomerFunctions||{};
</script>
<script
async
id="prefixbox-integration"
website="websiteTracker"
src="https://cdn.prefixbox.com/plugin/integration.js">
</script>
<!-- End Prefixbox Integration -->
or alternatively for GTM:
<!-- Prefixbox Integration -->
<script>
window.prefixboxAnalytics=window.prefixboxAnalytics||function(t,s,p,o){(window.pfbxQueue=window.pfbxQueue||[]).push({type:t,source:s,params:p,overrideObject:o});};
window.prefixboxFunctions=window.prefixboxFunctions||{}; window.prefixboxCustomerFunctions=window.prefixboxCustomerFunctions||{};
var ps=document.createElement("script");
ps.type="text/javascript";
ps.id="prefixbox-integration";
ps.setAttribute("website", "websiteTracker");
ps.async=1;
ps.src="https://cdn.prefixbox.com/plugin/integration.js";
document.getElementsByTagName("head")[0].appendChild(ps);
</script>
<!-- End Prefixbox Integration -->
Parameters:
- websiteTracker – This unique attribute is mandatory and has to be copied from the Prefixbox Portal after registration. The tracker code can be accessed from Settings > Websites.

SERP / Product Page Event API
SERP (Search Engine Results Page) is a web page with unique URL that displays search results for the users when they execute a search on a webshop.
An example for a SERP URL: https://mywebsite.com/search?keyword=samsung
Result Found
This event must be raised when the Search Engine results are returned. Everything you see in the highlighted area (1.) is a search engine result.

Syntax:
prefixboxAnalytics(‘result’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Pattern – the search keyword executed by the user.
- Count – the number of results that the search found – zero if no results were found.
- Page – the current search result page number being visited (optional). E.g.: if there are 3 pages of search results and the user is on the 1st page, the value of this parameter should be 1.
In our highlighted example below (2.) there are at least 5 pages and the user is on the 2nd one.

Example:
window.prefixboxAnalytics('result', 'serp', { pattern: 'samsung', count: 38, page: 1 });

No Result
This event must be raised when the Search Engine result is empty – like on the highlighted example (3.) below.

Syntax:
prefixboxAnalytics(‘result’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Pattern – the search keyword executed by the user.
- Count – zero (0).
- Page – optional value. E.g.: 1.
Example:
window.prefixboxAnalytics('result', 'serp', { pattern: 'asdfghjkl', count: 0, page: 1 });

Result Click
This event must be raised when the user clicks on any of the Search Engine results. Normally the users can click on a product picture (4.), or on the product’s name (5.) as well, but everything that opens a product page from the SERP can count as a “Result Click” event.

Syntax:
prefixboxAnalytics(‘click’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Pattern – the search keyword executed by the user.
- Position – the index of the search result the user clicked on (starting from 1). The product position is based on the product order – so in our case, the first product is an apple, the second one is an apricot, and the fifth one is a lemon.
- Product ID – the unique identifier of the product.
- Title – the title of the result the user clicked on.
- URL – the URL of the result page where the user is redirected after clicking on the result.
An example product URL: https://www.mywebsite.com/products/hk483-5
Optional fields of the inputParams object:
- Category – the category of the product, delimited by ‘/’ characters. E.g.: books/fantasy.
Example:
window.prefixboxAnalytics('click', 'serp', { pattern: 'samsung', position: 5, productId: 'hk483-5', title: 'Samsung Galaxy', url: 'https://www.mywebsite.com/products/hk483-5', category: 'Mobile phones' });

Add to cart
This event must be raised when the user adds a product to the shopping cart.
Products can be added to the cart from the SERP (6.):

Or from the product page (7.):

When adding a product to the cart, it’s also possible to set the quantity (8.) as an “Item Count”.
Syntax:
prefixboxAnalytics(‘cart’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Product ID – the unique identifier of the product.
- Title – the name of the product.
- URL – the unique URL of the product (product details page URL).
- Price – the price of the product. A decimal point can be used as a delimiter between the whole and fractional portion of the currency. The precision is up to 4 decimal places.
- Currency – the currency of the price of the product, service, software, etc. in the ISO 4217 3 letter format.
- Item Count – the number of products being added to the cart.
Optional fields of the inputParams object:
- Position – if the event happened on the Search Result Page, populate this parameter with the index of the search result.
- Pattern – if the event happened on the Search Result Page, populate this parameter with the search keyword.
- Category – the category of the product, delimited by ‘/’ characters. E.g.: books/fantasy
Example:
window.prefixboxAnalytics('cart', 'serp', { pattern: 'samsung', position: 5, productId: 'hk483-5', title: 'Samsung Galaxy', url: 'https://www.mywebsite.com/products/hk483-5', category: 'Mobile phones', price: 83000, currency: 'HUF', itemCount: 1 });
Add to cart (SERP)

Add to cart (product page)

Remove from cart
This event must be raised when the user removes a product (9.) from the shopping cart on the website.

Syntax:
prefixboxAnalytics(‘cartremove’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Product ID – the unique identifier of the product.
- Title – the name of the product.
- URL – the unique URL of the product (product details page URL).
- Price – the price of the product. A decimal point can be used as a delimiter between the whole and fractional portion of the currency. The precision is up to 4 decimal places.
- Currency – the currency of the price of the product, service, software, etc. in the ISO 4217 3 letter format.
- Item count – the number of products being added to the cart.
Optional fields of the inputParams object:
- Category – the category of the product, delimited by ‘/’ characters. E.g.: books/fantasy
Example:
window.prefixboxAnalytics('cartremove', 'serp', { productId: 'hk483-5', title: 'Samsung Galaxy', url: 'https://www.mywebsite.com/products/hk483-5', category: 'Mobile phones', price: 83000, currency: 'HUF', itemCount: 1 });

Item in order
This event must be raised when the user when a user finishes their order. The function should be called for each item in the order.

Syntax:
prefixboxAnalytics(‘orderitem’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Product ID – the unique identifier of the product.
- Title – the name of the product.
- URL – the unique URL of the product (product details page URL).
- Item price – the price of the product. A decimal point can be used as a delimiter between the whole and fractional portion of the currency. The precision is up to 4 decimal places.
- Currency – the currency of the price of the product, service, software, etc. in the ISO 4217 3 letter format.
- Item Count – the number of products being added to the cart.
Optional fields of the inputParams object:
- Category – the category of the product, delimited by ‘/’ characters. E.g.: books/fantasy
Example:
window.prefixboxAnalytics('orderitem', 'serp', { productId: 'hk483-5', title: 'Samsung Galaxy', url: 'https://www.mywebsite.com/products/hk483-5', category: 'Mobile phones', itemPrice: 83000, currency: 'HUF', itemCount: 1 });

Order complete
This event must be raised when the user when a user finishes their order.

Syntax:
prefixboxAnalytics(‘order’, ‘serp’, inputParams)
Required parameters of the inputParams object:
- Revenue – the total revenue of the order (the sum of all the prices of the items in the order). A decimal point can be used as a delimiter between the whole and fractional portion of the currency. The precision is up to 4 decimal places.
- Currency – the currency of the price of the product, service, software, etc. in the ISO 4217 3 letter format.
Example:
window.prefixboxAnalytics('order', 'serp', { revenue: 465790, currency: 'HUF' });
