Skip to content

Instantly share code, notes, and snippets.

@elephantsneverforget
Last active February 7, 2022 23:35
Show Gist options
  • Save elephantsneverforget/0ba3413a06ddbdd713e8652e1ed292fc to your computer and use it in GitHub Desktop.
Save elephantsneverforget/0ba3413a06ddbdd713e8652e1ed292fc to your computer and use it in GitHub Desktop.
// This object removes extraneous data being appended from the SSC. We will not have GA data to pull the information used in the existing tag
// We can use a UUID to identify customers when not logged in, and if the client logs in we can use the shopify id instead for the user_id variable
// You are currently sending client_id which relies on GA data and we don't have this
// ip_override assuming this is just the ip of the user
const sampleViewItem = {
page_location:
"https://www.dermalogica.com.au/collections/sensitive-skin-products/products/calm-water-gel",
page_title: "Calm Water Gel For Sensitive Skin | — Dermalogica AU",
event_name: "view_item",
items: [
{
item_id: 111268,
item_name: "calm water gel",
item_list_name: "/collections/sensitive-skin-products",
item_list_id: "/collections/sensitive-skin-products",
item_brand: "dermalogica",
item_category: "moisturisers",
item_variant: "50ml",
price: 79,
item_variant_id: 36255931859111,
item_product_id: 5745480040615
}
],
ip_override: "2001:56a:f072:b600:dd89:d4c3:b5f9:1fbf",
user_agent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
partner_id: "92334",
mapping_key: "515",
mapped_user_id: "Fpaiz_U2HEs64r6EiVNwi4fgeff8LlX2",
version: "criteo_sgtm_0.0.1",
enable_dising: false,
an: "com.dermalogica.sgtm",
cn: "",
ln: ""
};
// This is a sample object that Criteo is currently sending to the API but it contains some extraneous data that is being auto appended from the GTM SSC
const sampleViewItem = {
"x-ga-protocol_version": "2",
"x-ga-measurement_id": "G-1111111",
"x-ga-gtm_version": "2oe220",
"x-ga-page_id": 439116009,
screen_resolution: "3008x1692",
"x-ga-system_properties": { dbg: "1" },
language: "en-us",
client_id: "PbnJ720WKB6CXfF0xG8Sz/hJ9pjkb1lWre6kxQFctIQ=.1643986866",
"x-ga-request_count": 3,
page_location:
"https://www.dermalogica.com.au/collections/sensitive-skin-products/products/calm-water-gel",
page_referrer:
"https://www.dermalogica.com.au/collections/sensitive-skin-products",
page_title: "Calm Water Gel For Sensitive Skin | — Dermalogica AU",
ga_session_id: "1644156767",
ga_session_number: 3,
"x-ga-mp2-seg": "1",
event_name: "view_item",
engagement_time_msec: 3,
items: [
{
item_id: 111268,
item_name: "calm water gel",
item_list_name: "/collections/sensitive-skin-products",
item_list_id: "/collections/sensitive-skin-products",
item_brand: "dermalogica",
item_category: "moisturisers",
item_variant: "50ml",
price: 79,
item_variant_id: 36255931859111,
item_product_id: 5745480040615
}
],
"x-ga-mp2-richsstsse": "",
ip_override: "2001:56a:f072:b600:dd89:d4c3:b5f9:1fbf",
user_agent:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
"x-ga-js_client_id": "1688549575.1643986866",
partner_id: "92334",
mapping_key: "515",
mapped_user_id: "Fpaiz_U2HEs64r6EiVNwi4fgeff8LlX2",
version: "criteo_sgtm_0.0.1",
enable_dising: false,
an: "com.dermalogica.sgtm",
cn: "",
ln: ""
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment