1.0.2 • Published 5 years ago

webtrekk-smart-pixel-react v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Webtrekk Smart Pixel React

Site | Docs | Support | Changelog |

Installation

Using npm:

$ npm install --save webtrekk-smart-pixel-react

Integration

import * as wtSmart from "webtrekk-smart-pixel-react";

Components

<WebtrekkInitData>

import { WebtrekkInitData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkInitData
                trackId="111111111111111"
                trackDomain="analytics01.wt-eu02.net"
                domain="sub.domain.tld"
                cookie="1"
            />
        </div>
    );
}
ValueNotes
trackIdString. Required. Enter your Webtrekk customer ID, which is provided by Webtrekk.
trackDomainString. Required. Enter your Webtrekk tracking URL.
domainString. Optional. Defaults to location.host. Specify your domain, this domain is then not identified as a referrer.
cookieString. Optional. Defaults to 1. 1 The tracking pixel generates an ever ID. The ever ID is stored or read from the customer domain. It is then added to each tracking request. 3 The tracking pixel is not able to read the ever ID. Therefore, the tracking request is submitted without any ever ID.

<WebtrekkAdvancedData>

import { WebtrekkAdvancedData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkAdvancedData
                secureCookie={ false }
                optOutName="webtrekkOptOut"
                requestObfuscation={ false }
                forceOldEverId={ false }
                execCDB={ true }
                useCDBCache={ false }
                requestQueue={ {
                    activated: false,
                    ttl: 5 * 60 * 1000,
                    resendInterval: 5 * 1000,
                    size: 100
                } }
            />
        </div>
    );
}
ValueNotes
secureCookieBoolean. Optional. Defaults to false. true The "secure" flag is added to all client-side Webtrekk cookies.
optOutNameString. Optional. Defaults to webtrekkOptOut. Define an alternative name for the Webtrekk opt-out cookie.
requestObfuscationBoolean. Optional. Defaults to false. true This option hides all track requests to make it harder for adblockers to identify and block Webtrekk track requests.
forceOldEverIdBoolean. Optional. Defaults to false. true The ever IDs from previous pixel versions will be taken over.
execCDBBoolean. Optional. Defaults to true. Activate/ deactivate the Cross Device Bridge.
useCDBCacheBoolean. Optional. Defaults to false. Activate/ deactivate the image cache for the Cross Device Bridge.
requestQueue.activatedBoolean. Optional. Defaults to false. The offline tracking queue functionality is activated.
requestQueue.ttlNumber. Optional. Defaults to 5 * 60 * 1000. Specify the maximum time a request can remain in the queue until it is deleted.
requestQueue.resendIntervalNumber. Optional. Defaults to 5 * 1000. Define the interval in milliseconds when the first request in the queue.
requestQueue.sizeNumber. Optional. Defaults to 100. Maximum queue size for requests.

<WebtrekkPageData>

import { WebtrekkPageData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkPageData
                name="name of the page"
                search="search term"
                numberSearchResults={ 7 }
                errorMessages="error: ..."
                paywall={ false }
                articleTitle="article title"
                contentTags="content tags"
                title="page title"
                type="page type"
                length="medium"
                daysSincePublication={ 5 }
                testVariant="test variant"
                testExperiment="test experiment"
                parameter={ {5: "parameter value 5"} }
                category={ {8: "category value 8"} }
                goal={ {2: "goal value 2"} }
            />
        </div>
    );
}
ValueNotes
nameString. Optional. Defaults to url based page name. Unique identifier of your page.
searchString. Optional. Analyze keywords used by visitors to your site by including them in tracking.
numberSearchResultsNumber. Optional. Defaults to 0. Number of search results.
errorMessagesString. Optional. Error messages.
paywallBoolean. Optional. Defaults to false. Paywall calls.
articleTitleString. Optional. Title of the article.
contentTagsString. Optional. Tags contained in the article.
titleString. Optional. Title of the page.
typeString. Optional. Page type.
lengthString. Optional. Length of the page.
daysSincePublicationNumber. Optional. Defaults to 0. Days since the publication of the article.
testVariantString. Optional. Name of the test variant.
testExperimentString. Optional. Name of the test.
parameterObject. Optional. You can use page parameters to enrich your analytical data with your website-specific information and/ or metrics.
categoryObject. Optional. Categories are content groups that are used to group pages so that website areas can be formed to enable aggregated evaluations.
goalObject. Optional. When using website goals, all key targets for analysis and filtering are quickly available.

<WebtrekkCampaignData>

import { WebtrekkCampaignData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkCampaignData
                id="en.internal.newsletter.2017.05"
                mediaCode={ ["mc", "wt_mc"] }
                oncePerSession={ false }
                parameter={ {1: "Newsletter 123"} }
            />
        </div>
    );
}
ValueNotes
idString. Required. Set your campaign ID in the pixel.
mediaCodeArray<String>. Optional. Defaults to ["mc", "wt_mc"]. If you use media codes as a data source for your campaign tracking, entering the name of the media code parameter can increase tracking accuracy.
oncePerSessionBoolean. Optional. Defaults to false. true If you want to track each campaign only once within a particular session, you can force this with this parameter. The Smart Pixel then overwrites the campaign with "ignore" from the second-page view.
parameterObject. Optional. Campaign parameters can be entered either directly in the page configuration or the campaign configuration with a target URL along with the media code.

<WebtrekkCustomerData>

import { WebtrekkCustomerData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkCustomerData
                id="user5684798169"
                email="john.doe@webtrekk.com"
                emailRID=""
                emailOptin={ true }
                gender={ 1 }
                birthday="19870913"
                firstName="John"
                lastName="Doe"
                telephone="0049132456789"
                country="Germany"
                city="Berlin"
                postalCode="10115"
                street="Robert-Koch-Platz"
                streetNumber="4"
                category={ {5: "login"} }
                validation={ true }
            />
        </div>
    );
}
ValueNotes
idString. Required. Use this parameter to transfer a unique identifier for the user.
emailString. Optional. Use this parameter to transfer the email address of the user.
emailRIDString. Optional. Use this parameter to transfer the email receiver ID of the user.
emailOptInBoolean. Optional. Defaults to false. Use this parameter to transfer the opt-in email status of the user.
firstNameString. Optional. Use this parameter to transfer the first name of the user.
lastNameString. Optional. Use this parameter to transfer the last name of the user.
telephoneString. Optional. Use this parameter to transfer the phone number of the user.
genderNumber. Optional. Defaults to 0. Use this parameter to transfer the gender of the user. 1 male. 2 female.
birthdayString. Optional. Use this parameter to transfer the user's birthday (YYYYMMDD).
countryString. Optional. Use this parameter to transfer the country of the user.
cityString. Optional. Use this parameter to transfer the city of the user.
streetString. Optional. Use this parameter to transfer the street of the user.
streetNumberString. Optional. Use this parameter to transfer the house number of the user.
categoryObject. Optional. To create meaningful visitor segments, you can use this parameter to categorize customers.
validationBoolean. Optional. Defaults to false. true Should overwrite existing customer information.

<WebtrekkProductData>

import { WebtrekkProductData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkProductData
                id="ABC-123"
                action="view"
                cost={ 99.90 }
                quantity={ 2 }
                soldOut={ false }
                variant="green"
                parameter={ {1: "L"} }
                category={ {1: "tops", 2: "noname"} }
            />
        </div>
    );
}
ValueNotes
idString. Required. Saves the products stored in the shopping cart. This property must be entered if products are to be measured.
actionString. Required. The products can be transmitted to Webtrekk when: list a product is viewed in a catalog, view a product is viewed, basket a product is placed in the shopping cart and confirmation when the cart is purchased.
costNumber. Optional. Defaults to 0. Contains the product price ("0" prices are allowed). If you transfer a product more than once (quantity property greater than 1), use the total price instead of the unit price.
quantityNumber. Optional. Defaults to 0. Contains product quantity.
variantString. Optional. Use this parameter to transfer the variant of the product.
soldOutBoolean. Optional. Defaults to false. Use this parameter to indicate that the product is sold out or in stock. true sold out. false in stock.
parameterObject. Optional. Using parameters, you can enrich analytical data with your website-specific information and/ or metrics.
categoryObject. Optional. Product categories contain static information about the products. They allow you to group the products by assigning them uniquely to a product and product category.

<WebtrekkProductData>

import { WebtrekkOrderData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkOrderData
                value={ 120.99 }
                id="M-12345"
                couponValue={ 10.00 }
                paymentMethod="paypal"
                shippingService="dhl"
                shippingSpeed="express"
                shippingCosts={ 4.95 }
                grossMargin={ 12.95 }
                parameter={ {5: "bill"} }
            />
        </div>
    );
}
ValueNotes
valueString. Required. The property "value" stores the total order value. This property must be entered if you want to tracke the total order values.
idString. Optional. This optional property contains a unique order number (order ID). Using this setting ensures that no orders are counted twice.
couponValueNumber. Optional. Defaults to 0. Contains the value of a coupon. Use this parameter if the customer orders with a coupon.
paymentMethodString. Optional. Use this parameter to transfer the payment method of the order.
shippingServiceString. Optional. Use this parameter to transfer the shipping service of the order.
shippingSpeedString. Optional. Use this parameter to transfer the delivery time of the order.
shippingCostsNumber. Optional. Defaults to 0. Use this parameter to transfer the delivery costs of the order.
grossMarginNumber. Optional. Defaults to 0. Use this parameter to transfer the margin/ mark-up of the order.
orderStatusString. Optional. Use this parameter to transfer the order status.
parameterObject. Optional. Using parameters, you can enrich analytical data with your own web site-specific information and/or metrics.

<WebtrekkSessionData>

import { WebtrekkSessionData } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkCampaignData
                loginStatus="login"
                parameter={ {5: "male"} }
            />
        </div>
    );
}
ValueNotes
loginStatusString. Optional. Pass the current users login status here.
parameterObject. Optional. Session parameters always refer to one complete session (visit). If the value for the parameter is transmitted during a visit several times, only the first or last value is evaluated, based on the configuration of Webtrekk.

<WebtrekkAutoTracking>

import { WebtrekkAutoTracking } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <Switch>
                <Route exact path="/" component={ Home } />
                <Route path="*" component={ NotFound } />
            </Switch>

            <WebtrekkAutoTracking
                trackId="111111111111111"
                trackDomain="analytics01.wt-eu02.net"
                activateActions={ true }
                activateTeaser={ true }
                activateProductList={ true }
                activateContentEngagement={ true }
            />
        </div>
    );
}
ValueNotes
trackIdString. Required. Enter your Webtrekk customer ID, which is provided by Webtrekk.
trackDomainString. Required. Enter your Webtrekk tracking URL.
activateActionsBoolean. Optional. Defaults to false. Activates the automatic action tracking.
activateTeaserBoolean. Optional. Defaults to false. Activates the teaser tracking extension.
activateProductListBoolean. Optional. Defaults to false. Activates the product list extension.
activateContentEngagementBoolean. Optional. Defaults to false. Activates the content engagement extension.

<WebtrekkContentEngagement>

The Content Engagement Plugin is used to measure the reading behavior of your website visitors. The analysis data of the scrolling behavior are essential performance indicators - especially for content pages: It is, therefore, crucial for publishers to know how readers deal with a published article. The Content Engagement Plugin measures the percentage of an article read by the end consumer.

import { WebtrekkContentEngagement } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkContentEngagement
                selector="#my-content"
                name="My Content"
                percentageStepsInAnalytics={ 5 }
                sendContentEngagement={ 1 }
                percentageReached={ 25 }
                secondsReached={ 30 }
                largeBrowserResolution={ 1080 }
                largeBrowserSeconds={ 5 }
                mediumBrowserResolution={ 700 }
                mediumBrowserSeconds={ 5 }
                smallBrowserResolution={ 400 }
                smallBrowserSeconds={ 5 }
            >
                <div id="my-content">
                    <p>My Content</p>
                </div>
            </WebtrekkContentEngagement>
        </div>
    );
}
ValueNotes
selectorString. Optional. Defaults to children. Enter the element to be measured. You can pass the CSS selector of the element.
nameString. Optional. Defaults to current page name. Specify the name of the element to be measured. Alternatively, the plugin uses the name of the current page.
percentageStepsInAnalyticsNumber. Optional. Defaults to 5. Define the percentage intervals that are to be reported in Analytics (e.g., five means that the count is incremented in five steps).
sendContentEngagementNumber. Optional. Defaults to 0. Specify the event that triggers the request to Analytics. 0 The user clicks a link, reloads the page or is inactive until the end of the session. 1 The user exceeds a certain percentage (e.g., all 25% of the element). 2 After a certain number of seconds (e.g., every 30 seconds).
percentageReachedNumber. Optional. Defaults to 25. If you specify "percentage reached" as the event trigger, enter the desired percentage here (e.g., at 25%, the event is triggered after every 25%).
secondsReachedNumber. Optional. Defaults to 30. If you specify "seconds reached" as the event trigger, define the desired interval of seconds here (e.g., at 30 the event is triggered every 30 seconds).
largeBrowserResolutionNumber. Optional. Defaults to 1080. Specify the browser resolution for large browsers in pixels (greater than or equal to the specified number of pixels).
largeBrowserSecondsNumber. Optional. Defaults to 20. Specify the seconds to mark a section of the element as read on small browser resolutions.
mediumBrowserResolutionNumber. Optional. Defaults to 700. Specify the browser resolution for medium-sized browsers in pixels (greater than or equal to the specified number of pixels).
mediumBrowserSecondsNumber. Optional. Defaults to 10. Specify the seconds to mark a section of the element as read on medium browser resolutions.
smallBrowserResolutionNumber. Optional. Defaults to 400. Specify the browser resolution for small browsers in pixels (greater than or equal to the specified number of pixels).
smallBrowserSecondsNumber. Optional. Defaults to 5. Specify the seconds to mark a section of the element as read on small browser resolutions.

<WebtrekkProductList>

With the product list tracking extension you can analyze which products your visitors view and click in the catalog and on the product overview page.

import { WebtrekkProductList } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            { products.data.map(function(product, i) {
                return (
                    <WebtrekkProductList
                        selector={ `#${product.id}` }
                        id={ product.id }
                        position={ i + 1 }
                        cost={ product.cost }
                        quantity={ 1 }
                        variant={ product.variant }
                        soldOut={ product.isSoldOut }
                        parameter={ {
                            1: product.name,
                            2: product.material,
                            4: product.color
                        } }
                        category={ {
                            1: product.description
                        } }
                    >
                        <Link to={ "/product/" + product.id } id={ product.id }>
                            <ProductImage product={ product } products={ products } />
                        </Link>
                    </WebtrekkProductList>
                );
            }) }
        </div>
    );
}
ValueNotes
idString. Required. Specify the product identifier.
positionNumber. Required. Specify the product position within the list.
selectorString. Optional. Defaults to children. Enter the element to be measured. You can pass the CSS selector of the element.
costNumber. Optional. Contains the product price.
quantityNumber. Optional. Contains the product quantity.
variantString. Optional. Contains the product variants.
soldOutBoolean. Optional. Use this parameter to indicate that the product. true sold out. false in stock
categoryObject. Optional. Contains the product category.
parameterObject. Optional. You can use parameters to enrich analytical data with your website-specific information and/ or metrics.

<WebtrekkTeaser>

Webtrekk enables you with the use of the teaser tracking extension a comprehensive analysis of your onsite teasers. By integrating the extension, teaser views and clicks are automatically captured on your website. By specifying further parameters, it is possible to describe these in detail and evaluate them in combination with your web analytics data.

To evaluate the impact of a single teaser, in addition to views and clicks, engagement and conversion are calculated. The engagement measurement for a specific teaser is initiated as soon as it is clicked. For each page view that follows a teaser click, its engagement value is increased by 1. This happens until a website goal is reached or the user stops visiting the website.

import { WebtrekkTeaser } from "webtrekk-smart-pixel-react";

render()
{
    return (
        <div>
            <WebtrekkTeaser
                selector="#my-products"
                name="My products"
                rank="header"
                content="My products overview"
                variant="products"
                type="click"
                goal="order"
                value="10%"
            >
                <div id="my-products" className="content">
                    <Link to="/products">
                        My products
                    </Link>
                </div>
            </WebtrekkTeaser>
        </div>
    );
}
ValueNotes
nameString. Required. Specify the teaser name.
selectorString. Optional. Defaults to children. Enter the element to be measured. You can pass the CSS selector of the element.
rankString. Optional. Specify the teaser rank.
contentString. Optional. Specify the teaser content.
variantString. Optional. Specify the teaser variant.
seenBoolean. Optional. Defaults to false. true Teasers whose visibility is controlled via a zIndex, a rotation of different teaser elements or using some other dynamic method, must also be flagged if they are to be displayed. View tracking will be deactivated for this teaser. Click-, engagement- and conversion-tracking will still be activated.
typeString. Optional. Defaults to product. Specify the teaser conversion type. view The teaser should be connected to the conversion when the user has seen the teaser. click The teaser should be connected to conversion when the user has clicked on the teaser. product The teaser should be connected to conversion if the user has clicked on the teaser and the product is purchased with the same name as the teaser name.
goalString. Optional. Defaults to both. Specify the teaser conversion goal. order The teaser should only be connected to the conversion. goal The teaser should only be connected to the website goal. both The teaser should be connected to conversion or website goal.
valueString. Optional. Defaults to conversion value is the same as the product cost. Specify the teaser conversion value. percentage of order value Percentage of order value (i.e., 5%). fixed value Fixed value (i.e., 15).

WebtrekkSmartPixelReact

call

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.call((wtSmart) => {
    // do any tracking stuff here
});
ValueNotes
callbackfunction(wtSmart: wtSmart). Required. Callback method to interact with the origin Webtrekk Smart Pixel. For all functionalities see Docs

init

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.init({
     trackId: "111111111111111",
     trackDomain: "analytics01.wt-eu02.net",
     domain: "sub.domain.tld",
     cookie: "1"
});
ValueNotes
trackIdString. Required. Enter your Webtrekk customer ID, which is provided by Webtrekk.
trackDomainString. Required. Enter your Webtrekk tracking URL.
domainString. Optional. Defaults to location.host. Specify your domain, this domain is then not identified as a referrer.
cookieString. Optional. Defaults to 1. 1 The tracking pixel generates an ever ID. The ever ID is stored or read from the customer domain. It is then added to each tracking request. 3 The tracking pixel is not able to read the ever ID. Therefore, the tracking request is submitted without any ever ID.

advanced

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.advanced({
     secureCookie: false,
     optOutName: "webtrekkOptOut",
     requestObfuscation: false,
     forceOldEverId: false,
     execCDB: true,
     useCDBCache: false,
     requestQueue: {
     	activated: false,
     	ttl: 5 * 60 * 1000,
     	resendInterval: 5 * 1000,
     	size: 100
     }
});
ValueNotes
secureCookieBoolean. Optional. Defaults to false. true The "secure" flag is added to all client-side Webtrekk cookies.
optOutNameString. Optional. Defaults to webtrekkOptOut. Define an alternative name for the Webtrekk opt-out cookie.
requestObfuscationBoolean. Optional. Defaults to false. true This option hides all track requests to make it harder for adblockers to identify and block Webtrekk track requests.
forceOldEverIdBoolean. Optional. Defaults to false. true The ever IDs from previous pixel versions will be taken over.
execCDBBoolean. Optional. Defaults to true. Activate/ deactivate the Cross Device Bridge.
useCDBCacheBoolean. Optional. Defaults to false. Activate/ deactivate the image cache for the Cross Device Bridge.
requestQueue.activatedBoolean. Optional. Defaults to false. The offline tracking queue functionality is activated.
requestQueue.ttlNumber. Optional. Defaults to 5 * 60 * 1000. Specify the maximum time a request can remain in the queue until it is deleted.
requestQueue.resendIntervalNumber. Optional. Defaults to 5 * 1000. Define the interval in milliseconds when the first request in the queue.
requestQueue.sizeNumber. Optional. Defaults to 100. Maximum queue size for requests.

page

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.page("name of the page", {
     search: "search term",
     numberSearchResults: 7,
     errorMessages: "error: ...",
     paywall: false,
     articleTitle: "article title",
     contentTags: "content tags",
     title: "page title",
     type: "page type",
     length: "medium",
     daysSincePublication: 5,
     testVariant: "test variant",
     testExperiment: "test experiment",
     parameter: {5: "parameter value 5"},
     category: {8: "category value 8"},
     goal: {2: "goal value 2"}
});
ValueNotes
nameString. Optional. Defaults to url based page name. Unique identifier of your page.
searchString. Optional. Analyze keywords used by visitors to your site by including them in tracking.
numberSearchResultsNumber. Optional. Defaults to 0. Number of search results.
errorMessagesString. Optional. Error messages.
paywallBoolean. Optional. Defaults to false. Paywall calls.
articleTitleString. Optional. Title of the article.
contentTagsString. Optional. Tags contained in the article.
titleString. Optional. Title of the page.
typeString. Optional. Page type.
lengthString. Optional. Length of the page.
daysSincePublicationNumber. Optional. Defaults to 0. Days since the publication of the article.
testVariantString. Optional. Name of the test variant.
testExperimentString. Optional. Name of the test.
parameterObject. Optional. You can use page parameters to enrich your analytical data with your website-specific information and/ or metrics.
categoryObject. Optional. Categories are content groups that are used to group pages so that website areas can be formed to enable aggregated evaluations.
goalObject. Optional. When using website goals, all key targets for analysis and filtering are quickly available.

action

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.action({
     name: "en.click.on.some.link",
     parameter: {1: "en"},
     goal: {2: "goal value 2"}
});
ValueNotes
nameString. Required. Unique identifier of your action.
parameterObject. Optional. You can use action parameters to enrich your analytical data with your website-specific information and/ or metrics.
goalObject. Optional. When using website goals, all key targets for analysis and filtering are quickly available.

campaign

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.campaign({
     id: "en.internal.newsletter.2017.05",
     mediaCode: ["mc", "wt_mc"],
     oncePerSession: false,
     parameter: {1: "Newsletter 123"}
});
ValueNotes
idString. Required. Set your campaign ID in the pixel.
mediaCodeArray<String>. Optional. Defaults to ["mc", "wt_mc"]. If you use media codes as a data source for your campaign tracking, entering the name of the media code parameter can increase tracking accuracy.
oncePerSessionBoolean. Optional. Defaults to false. true If you want to track each campaign only once within a particular session, you can force this with this parameter. The Smart Pixel then overwrites the campaign with "ignore" from the second-page view.
parameterObject. Optional. Campaign parameters can be entered either directly in the page configuration or the campaign configuration with a target URL along with the media code.

customer

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.customer("user5684798169", {
     email: "john.doe@webtrekk.com",
     emailRID: "",
     emailOptin: true,
     gender: 1,
     birthday: "19870913",
     firstName: "John",
     lastName: "Doe",
     telephone: "0049132456789",
     country: "Germany",
     city: "Berlin",
     postalCode: "10115",
     street: "Robert-Koch-Platz",
     streetNumber: "4",
     category: {5: "login"}
}, false);
ValueNotes
idString. Required. Use this parameter to transfer a unique identifier for the user.
emailString. Optional. Use this parameter to transfer the email address of the user.
emailRIDString. Optional. Use this parameter to transfer the email receiver ID of the user.
emailOptInBoolean. Optional. Defaults to false. Use this parameter to transfer the opt-in email status of the user.
firstNameString. Optional. Use this parameter to transfer the first name of the user.
lastNameString. Optional. Use this parameter to transfer the last name of the user.
telephoneString. Optional. Use this parameter to transfer the phone number of the user.
genderNumber. Optional. Defaults to 0. Use this parameter to transfer the gender of the user. 1 male. 2 female.
birthdayString. Optional. Use this parameter to transfer the user's birthday (YYYYMMDD).
countryString. Optional. Use this parameter to transfer the country of the user.
cityString. Optional. Use this parameter to transfer the city of the user.
streetString. Optional. Use this parameter to transfer the street of the user.
streetNumberString. Optional. Use this parameter to transfer the house number of the user.
categoryObject. Optional. To create meaningful visitor segments, you can use this parameter to categorize customers.
validationBoolean. Optional. Defaults to false. true Should overwrite existing customer information.

product

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.product("view", {
     id: "ABC-123",
     cost: 99.90,
     quantity: 2,
     soldOut: false,
     variant: "green",
     parameter: {1: "L"},
     category: {1: "tops", 2: "noname"}
});
ValueNotes
actionString. Required. The products can be transmitted to Webtrekk when: list a product is viewed in a catalog, view a product is viewed, basket a product is placed in the shopping cart and confirmation when the cart is purchased.
idString. Required. Saves the products stored in the shopping cart. This property must be entered if products are to be measured.
costNumber. Optional. Defaults to 0. Contains the product price ("0" prices are allowed). If you transfer a product more than once (quantity property greater than 1), use the total price instead of the unit price.
quantityNumber. Optional. Defaults to 0. Contains product quantity.
variantString. Optional. Use this parameter to transfer the variant of the product.
soldOutBoolean. Optional. Defaults to false. Use this parameter to indicate that the product is sold out or in stock. true sold out. false in stock.
parameterObject. Optional. Using parameters, you can enrich analytical data with your website-specific information and/ or metrics.
categoryObject. Optional. Product categories contain static information about the products. They allow you to group the products by assigning them uniquely to a product and product category.

products

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.products("view", [{
     id: "ABC-123",
     cost: 99.90,
     quantity: 2,
     soldOut: false,
     variant: "green",
     parameter: {1: "L"},
     category: {1: "tops", 2: "noname"}
}]);
ValueNotes
actionString. Required. The products can be transmitted to Webtrekk when: list a product is viewed in a catalog, view a product is viewed, basket a product is placed in the shopping cart and confirmation when the cart is purchased.
idString. Required. Saves the products stored in the shopping cart. This property must be entered if products are to be measured.
costNumber. Optional. Defaults to 0. Contains the product price ("0" prices are allowed). If you transfer a product more than once (quantity property greater than 1), use the total price instead of the unit price.
quantityNumber. Optional. Defaults to 0. Contains product quantity.
variantString. Optional. Use this parameter to transfer the variant of the product.
soldOutBoolean. Optional. Defaults to false. Use this parameter to indicate that the product is sold out or in stock. true sold out. false in stock.
parameterObject. Optional. Using parameters, you can enrich analytical data with your website-specific information and/ or metrics.
categoryObject. Optional. Product categories contain static information about the products. They allow you to group the products by assigning them uniquely to a product and product category.

order

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.order({
     value: 120.99,
     id: "M-12345",
     couponValue: 10.00,
     paymentMethod: "paypal",
     shippingService: "dhl",
     shippingSpeed: "express",
     shippingCosts: 4.95,
     grossMargin: 12.95,
     parameter: {5: "bill"}
});
ValueNotes
valueString. Required. The property "value" stores the total order value. This property must be entered if you want to tracke the total order values.
idString. Optional. This optional property contains a unique order number (order ID). Using this setting ensures that no orders are counted twice.
couponValueNumber. Optional. Defaults to 0. Contains the value of a coupon. Use this parameter if the customer orders with a coupon.
paymentMethodString. Optional. Use this parameter to transfer the payment method of the order.
shippingServiceString. Optional. Use this parameter to transfer the shipping service of the order.
shippingSpeedString. Optional. Use this parameter to transfer the delivery time of the order.
shippingCostsNumber. Optional. Defaults to 0. Use this parameter to transfer the delivery costs of the order.
grossMarginNumber. Optional. Defaults to 0. Use this parameter to transfer the margin/ mark-up of the order.
orderStatusString. Optional. Use this parameter to transfer the order status.
parameterObject. Optional. Using parameters, you can enrich analytical data with your own web site-specific information and/or metrics.

session

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.session({
     loginStatus: "login",
     parameter: {5: "male"}
});
ValueNotes
loginStatusString. Optional. Pass the current users login status here.
parameterObject. Optional. Session parameters always refer to one complete session (visit). If the value for the parameter is transmitted during a visit several times, only the first or last value is evaluated, based on the configuration of Webtrekk.

track

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.track(false);
ValueNotes
keepDataBoolean. Optional. Defaults to false. After sending the tracking data, the Webtrekk Smart Pixel automatically removes all defined data. If you want to keep the data, set true as the first argument, then you can delete the data manually.

trackPage

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.trackPage(false);
ValueNotes
keepDataBoolean. Optional. Defaults to false. After sending the tracking data, the Webtrekk Smart Pixel automatically removes all defined data. If you want to keep the data, set true as the first argument, then you can delete the data manually.

trackAction

import { WebtrekkSmartPixelReact } from "webtrekk-smart-pixel-react";

WebtrekkSmartPixelReact.trackAction(false);
ValueNotes
keepDataBoolean. Optional. Defaults to false. After sending the tracking data, the Webtrekk Smart Pixel automatically removes all defined data. If you want to keep the data, set true as the first argument, then you can delete the data manually.

webtrekkReducer

custom actions

import React, { useReducer } from "react";
import { WebtrekkSmartPixelReact, webtrekkReducer } from "webtrekk-smart-pixel-react";

const webtrekkCustomReducer = webtrekkReducer({
    "increment": (state, action, reducerValue) => {
        WebtrekkSmartPixelReact.action({
            name: action.type,
            parameter: {1: reducerValue.count + ""}
        });
        WebtrekkSmartPixelReact.trackAction();
    },
    "decrement": (state, action, reducerValue) => {
        WebtrekkSmartPixelReact.action({
            name: action.type,
            parameter: {1: reducerValue.count + ""}
        });
        WebtrekkSmartPixelReact.trackAction();
    }
});

const initialState = {count: 0};
const reducer = (state, action) => {
    switch (action.type) {
        case "increment": return {count: state.count + 1};
        case "decrement": return {count: state.count - 1};
        default: throw new Error();
    }
};
const Counter = () => {
    const [state, dispatch] = useReducer(webtrekkCustomReducer(reducer), initialState);

    return (
        <div>
            Count: { state.count }
            <button onClick={() => dispatch({type: "increment"})}>+</button>
            <button onClick={() => dispatch({type: "decrement"})}>-</button>
        </div>
    );
};

class CounterButton extends React.Component {
    render() {
        return (
            <Counter />
        );
    }
}

export default CounterButton;
ValueNotes
actionsObject. Optional. Extends your own actions and execute custom tracking code after dispatch your action.
arguments0Object. Your current state.
arguments1Object. Your current action.
arguments2Object. Value of your reducer function.

dispatch with tracking data

import React, { useReducer } from "react";
import { webtrekkReducer } from "webtrekk-smart-pixel-react";

const webtrekkCustomReducer = webtrekkReducer();

const initialState = {count: 0};
const reducer = (state, action) => {
    switch (action.type) {
        case "increment": return {count: state.count + 1};
        case "decrement": return {count: state.count - 1};
        default: throw new Error();
    }
};
const Counter = () => {
    const [state, dispatch] = useReducer(webtrekkCustomReducer(reducer), initialState);

    return (
        <div>
            Count: { state.count }
            <button onClick={() => dispatch({
                type: "increment",
                webtrekk: {
                    type: "webtrekk/action",
                    sendInstantly: true,
                    data: {
                        name: "increment",
                        parameter: {1: state.count + ""}
                    }
                }
            })}>+</button>
            <button onClick={() => dispatch({
                type: "decrement",
                webtrekk: {
                    type: "webtrekk/action",
                    sendInstantly: true,
                    data: {
                        name: "decrement",
                        parameter: {1: state.count + ""}
                    }
                }
            })}>-</button>
        </div>
    );
};

class CounterButton extends React.Component {
    render() {
        return (
            <Counter />
        );
    }
}

export default CounterButton;
ValueNotes
webtrekk.typeString. Required. Defines which type of tracking data you are add to the tracking pixel. You can use one of the following types: webtrekk/init, webtrekk/advanced, webtrekk/page, webtrekk/action, webtrekk/session, webtrekk/campaign, webtrekk/customer, webtrekk/product, webtrekk/products, webtrekk/order, webtrekk/extension, webtrekk/track, webtrekk/trackPage or webtrekk/trackAction.
webtrekk.dataAny. Required. Defines which data you are add to the tracking pixel.
webtrekk/init. See init.
webtrekk/advanced. See advanced.
webtrekk/page. See page.
webtrekk/action. See action.
webtrekk/session. See session.
webtrekk/campaign. See campaign.
webtrekk/customer. See customer.
webtrekk/product. See product.
webtrekk/products. See products.
webtrekk/order. See order.
webtrekk/track. See track.
webtrekk/trackPage. See trackPage.
webtrekk/trackAction. See trackAction.
webtrekk.sendInstantlyBoolean. Optional. Defaults to false. true All added data are instantly tracked (you must not call track).

webtrekkMiddleware

custom actions

import { createStore, applyMiddleware, compose } from "redux";
import { WebtrekkSmartPixelReact, webtrekkMiddleware } from "webtrekk-smart-pixel-react";

const enhancers = [];
const middleware = [webtrekkMiddleware({
    "increment": (state, action) => {
        WebtrekkSmartPixelReact.action({
            name: action.type,
            parameter: {1: state.count + ""}
        });
        WebtrekkSmartPixelReact.trackAction();
    },
    "decrement": (state, action) => {
        WebtrekkSmartPixelReact.action({
            name: action.type,
            parameter: {1: state.count + ""}
        });
        WebtrekkSmartPixelReact.trackAction();
    }
})];
const reducer = (state, action) => {
    switch (action.type) {
        case "increment": state.count + 1; return state;
        case "decrement": state.count - 1; return state;
        default: return state;
    }
};

const composedEnhancers = compose(applyMiddleware(...middleware), ...enhancers);

const store = createStore(reducer, composedEnhancers);

store.dispatch({type: "increment"});
ValueNotes
actionsObject. Optional. Extends your own actions and execute custom tracking code after dispatch your action.
arguments0Object. Your current state.
arguments1Object. Your current action.

dispatch with tracking data

import { createStore, applyMiddleware, compose } from "redux";
import { WebtrekkSmartPixelReact, webtrekkMiddleware } from "webtrekk-smart-pixel-react";

const enhancers = [];
const middleware = [webtrekkMiddleware()];
const reducer = (state, action) => {
    switch (action.type) {
        case "increment": state.count + 1; return state;
        case "decrement": state.count - 1; return state;
        default: return state;
    }
};

const composedEnhancers = compose(applyMiddleware(...middleware), ...enhancers);

const store = createStore(reducer, composedEnhancers);

store.dispatch({
    type: "increment",
    webtrekk: {
        type: "webtrekk/action",
        sendInstantly: true,
        data: {
            name: "increment",
            parameter: {1: store.getState().count + ""}
        }
    }
});
ValueNotes
webtrekk.typeString. Required. Defines which type of tracking data you are add to the tracking pixel. You can use one of the following types: webtrekk/init, webtrekk/advanced, webtrekk/page, webtrekk/action, webtrekk/session, webtrekk/campaign, webtrekk/customer, webtrekk/product, webtrekk/products, webtrekk/order, webtrekk/extension, webtrekk/track, webtrekk/trackPage or webtrekk/trackAction.
webtrekk.dataAny. Required. Defines which data you are add to the tracking pixel.
webtrekk/init. See init.
webtrekk/advanced. See advanced.
webtrekk/page. See page.
webtrekk/action. See action.
webtrekk/session. See session.
webtrekk/campaign. See campaign.
webtrekk/customer. See customer.
webtrekk/product. See product.
webtrekk/products. See products.
webtrekk/order. See order.
webtrekk/track. See track.
webtrekk/trackPage. See trackPage.
webtrekk/trackAction. See trackAction.
webtrekk.sendInstantlyBoolean. Optional. Defaults to false. true All added data are instantly tracked (you must not call track).
1.0.2

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago