Skip to content

Instantly share code, notes, and snippets.

View elephantsneverforget's full-sized avatar

Jonathan Cairo elephantsneverforget

View GitHub Profile
SELECT
-- meta event info
JSON_EXTRACT_SCALAR(data, '$.event.event_name') AS event_name,
JSON_EXTRACT_SCALAR(data, '$.domain') AS domain,
-- event data
JSON_EXTRACT_SCALAR(data, '$.event.browser.page_title') AS page_title,
JSON_EXTRACT_SCALAR(data, '$.event.browser.page_url') AS page_url,
TIMESTAMP(JSON_EXTRACT_SCALAR(data, '$.event.event_time')) AS event_time,
JSON_EXTRACT_SCALAR(data, '$.event.id') AS event_id,
const functions = require('@google-cloud/functions-framework');
functions.cloudEvent('helloPubSub', cloudEvent => {
// The Pub/Sub message from Elevar is passed as the CloudEvent's data payload.
const base64Data = cloudEvent.data.message.data;
// Decode the base 64 encoded message
const data = Buffer.from(base64Data, 'base64').toString();
// Log the results
window.ElevarDataLayer.push({
event: "dl_subscribe",
lead_type: "email",
user_properties: { customer_email: {{contact.email}} }
});
const functions = require('@google-cloud/functions-framework');
functions.cloudEvent('helloPubSub', cloudEvent => {
// The Pub/Sub message from Elevar is passed as the CloudEvent's data payload.
const base64Data = cloudEvent.data.message.data;
// Decode the base 64 encoded message
const data = Buffer.from(base64Data, 'base64').toString()
// Log the results
console.log(data);
});
{
"event": "dl_purchase",
"event_id": "104f631f-9e90-4a1d-8339-f17a6ccae5eb",
"event_time": "2025-01-20T14:52:23.200Z",
"event_state": "OTHER",
"user_properties": {
"session_id": "1737384685",
"session_count": "4",
"visitor_type": "logged_in",
"customer_id": "7516348973117",
{
"textPayload": "Hello",
"channelConfig": {
"id": 1169,
"all_markets": true,
"market_groups": [],
"label": "Prototypin",
"live": true,
"debug": true,
"prototypingEnabled": true,
{
"insertId": "66fb100c000ed4dbaaa1192f",
"jsonPayload": {
"client": "vuori-clothing.myshopify.com",
"extra": {
"type": "Sending Event",
"event": {
"data": [
{
"user": {
{
"partialFailureError": {
"code": 3,
// Unfortuneatly it seems only the first error is highlighted.
// To reference the details of each error we'll need to index into the "details" array based on the empty objects noted below
"message": "Multiple errors in ‘details’. First error: The provided user identifiers are not supported. Use only hashed email or phone number and try again., at conversions[0].user_identifiers[0]",
"details": [
{
"@type": "type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure",
"errors": [
{
"error": {
"message": "(#100) Missing Permission",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "ArwbZb_gDgTYZIONKpgNfmx"
}
}