The TikTok Pixel is a piece of code that you can place on your website that allows advertisers to share website visitor events to TikTok via a browser. The pixel might be right for you if you're looking for a solution that's already prebuilt and is easy to set up and maintain.
Standard Events
Events are defined as actions a website visitor takes to achieve a business goal, like adding an item to a cart, filling out a form or making a purchase. Events can result from a TikTok ad (paid), or can come organically (unpaid). Events help you build marketing audiences, optimize ad delivery and measure campaign performance.
Event | Description |
---|---|
|
Count every time someone clicks on a specific element on your website as an event. This could be adding something to a cart, submitting a form, or downloading an app. Click events use web elements of the buttons or links you want to track. |
URL Events |
Count user visits to specific pages on your website as events. This could include the confirmation page after a "complete payment" or a "thank you" page. URL events use keywords contained in the URL of the page you want to track.
|
Click Event
window.addEventListener('message', function(message) {
if (message.data && message.data.event_type === 'spottButtonAction') {
ttq('track',
'ClickButton', {
content_name: message.data.event_data.asset?.name,
content_category: message.data.event_data.asset?.customFields?.category,
content_id: message.data.event_data.asset?.id,
content_type: 'product',
value: message.data.event_data.asset?.customFields?.price,
price: message.data.event_data.asset?.customFields?.price,
currency: message.data.event_data.asset?.customFields?.currency,
description: message.data.event_data.asset?.description
});
}
});
Interaction Event
window.addEventListener('message', function(message) {
if (message.data && message.data.event_type === 'spottInteractionEvent') {
ttq('track',
'ViewContent', {
content_name: message.data.event_data.asset?.name,
content_category: message.data.event_data.asset?.customFields?.category,
content_id: message.data.event_data.asset?.id,
content_type: 'product',
value: message.data.event_data.asset?.customFields?.price,
price: message.data.event_data.asset?.customFields?.price,
currency: message.data.event_data.asset?.customFields?.currency,
description: message.data.event_data.asset?.description
});
}
});
Comments
0 comments