TikTok Pixel Integration

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1221
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1163
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    855
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1056
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    828
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    825

TikTok Pixel Integration

TikTok Pixel is a conversion tracking tool for TikTok ads. It allows optimizing campaigns for purchases, registrations, and other target actions on your site.

Basic Code Installation

<script>
!function (w, d, t) {
    w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify",
    "instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],
    ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};
    for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);
    ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)
    ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){
    var i="https://analytics.tiktok.com/i18n/pixel/events.js";
    ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,
    ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");
    o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;
    var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};
    ttq.load('PIXEL_ID');ttq.page();
}(window, document, 'ttq');
</script>

Standard Events

// View product
ttq.track('ViewContent', {
    contents: [{ content_id: productId, content_name: productName }],
    value: product.price,
    currency: 'RUB'
});

// Purchase
ttq.track('CompletePayment', {
    contents: orderItems.map(i => ({ content_id: i.productId, quantity: i.qty, price: i.price })),
    value:    orderTotal,
    currency: 'RUB',
    order_id: orderId
});

// Registration
ttq.track('CompleteRegistration', { value: 0, currency: 'RUB' });

User Identification

// Send data for advanced matching
ttq.identify({
    sha256_email: sha256(user.email.toLowerCase()),
    sha256_phone_number: sha256(normalizePhone(user.phone))
});

Events API (Server Pixel)

Http::withToken(env('TIKTOK_ACCESS_TOKEN'))
    ->post('https://business-api.tiktok.com/open_api/v1.3/event/track/', [
        'pixel_code' => env('TIKTOK_PIXEL_ID'),
        'event'      => 'CompletePayment',
        'timestamp'  => time(),
        'context'    => [
            'user' => [
                'sha256_email' => hash('sha256', strtolower($user->email)),
                'sha256_phone' => hash('sha256', normalizePhone($user->phone))
            ],
            'page' => ['url' => $pageUrl]
        ],
        'properties' => [
            'contents'  => $itemsArray,
            'value'     => $total / 100,
            'currency'  => 'RUB'
        ],
        'event_id' => "purchase_{$orderId}"
    ]);

Setup time: a few hours.