This file contains 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
var formTrackingModule = (function($){ | |
var config = { | |
inputTypesTracking : ["text", "radio", "checkbox"], | |
inputEventsTracking : ["focus", "blur"], | |
timeTracking : true, | |
ConsoleLogging : true, | |
focusCounter : true, | |
mapper : { | |
lastFocusName : 'eVar20', |
This file contains 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
WITH user_cart_journeys AS ( | |
SELECT | |
user_pseudo_id | |
,event_timestamp | |
,event_name | |
,RANK() OVER (PARTITION BY user_pseudo_id ORDER BY event_timestamp) AS rank | |
FROM | |
`bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*` | |
WHERE | |
_TABLE_SUFFIX BETWEEN '20210101' AND '20210131' |
This file contains 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
WITH unnestedHits AS ( | |
SELECT | |
fullVisitorId | |
,visitId | |
,visitStartTime | |
,h.* | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20170801` | |
,UNNEST(hits) AS h | |
) |
This file contains 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
import imp | |
import requests | |
import jwt | |
from datetime import datetime, timedelta | |
from google.cloud import bigquery | |
import pandas as pd | |
import base64 | |
import json | |
def main(event, context): |
This file contains 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
// Payments | |
created,available_on,currency,gross,fee,net,reporting_category,description | |
// Subscriptions | |
id,customer,start_date,cancel_at,amount,currency |
This file contains 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
// Load Day.js | |
eval(UrlFetchApp.fetch('https://unpkg.com/[email protected]/dayjs.min.js').getContentText()); | |
eval(UrlFetchApp.fetch('https://unpkg.com/[email protected]/locale/pl.js').getContentText()); | |
dayjs.locale('pl') | |
eval(UrlFetchApp.fetch('https://unpkg.com/[email protected]/plugin/weekday.js').getContentText()); | |
dayjs.extend(dayjs_plugin_weekday) | |
eval(UrlFetchApp.fetch('https://unpkg.com/[email protected]/plugin/utc.js').getContentText()); | |
dayjs.extend(dayjs_plugin_utc) | |
var config = { |
This file contains 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
function runQuery() { | |
// Replace this value with the project ID listed in the Google | |
// Cloud Platform project. | |
const projectId = ''; | |
const request = { | |
query: 'WITH lastSunday AS (SELECT CASE WHEN EXTRACT(DAYOFWEEK FROM CURRENT_DATE()) = 1 THEN DATE_SUB(CURRENT_DATE(),INTERVAL 3 DAY) ELSE DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY) END AS d)' + | |
'SELECT Date, Package_Name, Product_ID, Country, New_Subscriptions, Cancelled_Subscriptions, Active_Subscriptions, _LATEST_DATE, _DATA_DATE FROM `` WHERE Date BETWEEN DATE_TRUNC((SELECT d FROM lastSunday), WEEK(MONDAY)) AND DATE_TRUNC(CURRENT_DATE(), WEEK(SUNDAY)) ORDER BY Date DESC', | |
useLegacySql: false | |
}; |
This file contains 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
function forEachRangeCell(range, f) { | |
const numRows = range.getNumRows(); | |
const numCols = range.getNumColumns(); | |
for (let i = 1; i <= numCols; i++) { | |
for (let j = 1; j <= numRows; j++) { | |
const cell = range.getCell(j, i) | |
f(cell) | |
} |