This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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||{},ttq._partner = ttq._partner || "Elevar"; | |
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('{{TikTok - Pixel ID}}'); | |
ttq.page(); | |
}(window, document, 'ttq'); | |
< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type IterableEventPayload = { | |
eventName: string; | |
email?: string; | |
campaignId?: string; | |
dataFields: { | |
updatedShoppingCartItems?: Array<IterableItem>; // used for add to cart events | |
items?: Array<IterableItem>; // used for view item and view item list | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id":5056588251172, | |
"admin_graphql_api_id":"gid://shopify/Order/5056588251172", | |
"app_id":580111, | |
"browser_ip":"96.52.89.147", | |
"buyer_accepts_marketing":false, | |
"cancel_reason":null, | |
"cancelled_at":null, | |
"cart_token":"f42fe2371240a96af5f020b33df894fe", | |
"checkout_id":39632471883812, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.ElevarPushToDataLayer({ | |
event: "dl_add_to_cart", // this is the event name that is used in the transformation | |
// NOT REQUIRED FOR ADD TO CART user_properties: userProperties, | |
ecommerce: { | |
currencyCode: "USD", | |
add: { | |
actionField: { | |
list: location.pathname // this should be the collection page URL that user clicked product from | |
}, | |
products: [{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.ElevarTransformFn = item => { | |
if (item.event === "dl_add_to_cart") { | |
return { | |
...item, // This is the original event | |
// Example of how to add properties Zulily is requesting. These properties do not need to be added for every event | |
// Tasks in Asana contain the values that should be added for each event. | |
collectionId: "value", | |
IsCartAddFromProdDetail: "value", | |
IsCartAddFromSmartCart: "value", | |
PageEventId: "value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "sh-2e2ddd21-A193-4AA0-4788-2BB324F0CDB1", | |
"name": "checkout_started", | |
"data": { | |
"checkout": { | |
"attributes": [ | |
{ | |
"key": "_elevar_visitor_info", | |
"value": "{\"user_id\":\"1382f594-da17-4216-8581-ef02b963a780\",\"session_id\":\"1692991082\",\"session_count\":\"42\",\"referrer\":\"https://tagassistant.google.com/\"}" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
function getCookie(name) { | |
let value = "; " + document.cookie; | |
let parts = value.split("; " + name + "="); | |
if (parts.length == 2) return parts.pop().split(";").shift(); | |
} | |
let consent = getCookie("__zulily_consent_granted"); // or localStorage.getItem("__zulily_consent_granted") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type SendlaneEventPayload = { | |
token: string; | |
custom_event: string; | |
email?: string; | |
phone?: string; | |
user: { | |
firstName?: string; | |
lastName?: string; | |
city?: string; | |
country?: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {PubSub} = require('@google-cloud/pubsub'); | |
async function listenForMessages() { | |
const pubsub = new PubSub(); | |
const subscriptionName = 'elevar-event-subscription'; | |
const subscription = pubsub.subscription(subscriptionName); | |
const messageHandler = (message) => { | |
// Handle event | |
message.ack(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type ImpactRadiusEventPayload = ImpactRadiusLineItems & { | |
CampaignId: string; | |
ActionTrackerId: string; | |
EventDate: string; | |
ClickId: string; | |
OrderId?: string | number; | |
CustomerId: string | number; | |
CustomerEmail: string; | |
OrderPromoCode: string; | |
CurrencyCode?: string; |