Skip to content

Instantly share code, notes, and snippets.

View elephantsneverforget's full-sized avatar

Jonathan Cairo elephantsneverforget

View GitHub Profile
export type PubSubEventPayload = {
cookies: Partial<Record<ValidCookieKeys, string>>; // cookie values present on event
landingSite: Partial<Record<TrackedQueryParams, string>>; // first click params
visitorInfo: Omit<VisitorInfo, (typeof TRACKED_MISC)["GTM_CONSENT"]>; // only on purchase events Elevar notes data
customerInfo: CustomerInfo & { _enriched: Array<keyof CustomerInfo> }; // enriched data
domain: string; // site domain
event: StandardEvent;
userConsent: VisitorInfo[(typeof TRACKED_MISC)["GTM_CONSENT"]]; // consent status
// sources: Array<"DL" | "Webhook" | "Webpixel">; // sources of the event
// cartContents: Array<CartContent>; // cart contents at time of event
mid: webhookEventContext.config.rakuten.adAccountId,
ord: "#1507",
tr: "RAKUTENCLICKIDTEST",
land: "20230415_1916",
date: "20210303_1952",
amtlist: "1997|4505|4505|2126",
skulist: "2215648_11417|4899715_10774|4899715_10779|6335694_11325",
qlist: "1|1|1|1",
cur: "USD",
namelist:
export type IterableEventPayload = {
eventName: string;
email?: string;
campaignId?: string;
dataFields: {
pageUrl?: string;
updatedShoppingCartItems?: Array<IterableItem>; // used for add to cart events
items?: Array<IterableItem>; // used for view item and view item list
};
{
"event_id": "3af07d47-134c-4e63-96c5-bfd25fb5f42e",
"event_time": "2023-09-13T21:58:55.258Z",
"user_properties": {
"user_id": "968268fe-78f6-4a83-9617-f5bf3d03a211",
"session_id": "1694642318",
"session_count": "17",
"visitor_type": "guest"
},
"device": {

Server Side E Comm Events

  • add payment info
  • add shipping info
  • add to cart
  • begin checkout
  • login
  • purchase
  • remove from cart
  • select item
  • sign up
<script id="elevar-dl-listener-config" type="application/json">{"data_layer_listener_script": "https://shopify-gtm-suite.getelevar.com/shops/c88f2922285b2da8178764fed5839861d5927386/3.4.3/events.js", "ss_url": "https://hits.getelevar.com", "signing_key": "UHcEMHgcma4ZgNIxXveQPEPocD6zZJj6", "myshopify_domain": "my-obvi.myshopify.com"}</script>
<script>
(() => {
if (!window.__ElevarIsGtmSuiteListenerCalled) {
window.__ElevarIsGtmSuiteListenerCalled = true;
const configElement = document.getElementById(
"elevar-dl-listener-config"
);
if (!configElement) {
// These events are cusom Zulily events outside the scope of what Elevar tracks
// Please ask Zulily for details
dataLayer.push({
event: "collection_list_view",
collectionIdList: val,
pagetype: // ItemDetail page or Cart View page,
eventId: val // UUID v4
items: [123, 456, ...], // array of variant ids
});
/** View Cart/Mini Cart **/
window.ElevarPushToDataLayer({
event: "dl_view_cart",
cart_total: "100.00",
ecommerce: {
currencyCode: "USD",
actionField: {
list: "Shopping Cart"
},
impressions: [{
/** Collection/Search page product click...
this is the product the user clicks on from collection page **/
window.ElevarPushToDataLayer({
event: "dl_select_item",
ecommerce: {
currencyCode: "USD",
click: {
actionField: {
list: location.pathname, // this should be the collection page URL
action: "click"
window.ElevarPushToDataLayer({
event: "dl_remove_from_cart",
ecommerce: {
currencyCode: "USD",
remove: {
actionField: {
list: location.pathname // this should be the collection page URL that user clicked product from
},
products: const products = [{
id: "LB00161-34689553170476", // SKU