Skip to content

Instantly share code, notes, and snippets.

View prabapro's full-sized avatar
🍃
Working from home

Praba Ponnambalam prabapro

🍃
Working from home
View GitHub Profile
@prabapro
prabapro / google-consent-mode-v2-status.js
Last active February 12, 2025 07:03
Log Google Consent Mode v2 status to the browser console
@prabapro
prabapro / git_commit_and_push.sh
Last active August 13, 2023 08:19
This shell script streamlines Git commits and pushes with emoji-enhanced commit messages. It allows selecting a branch, displays files to be committed, adds emojis based on keywords, commits changes, and offers the choice to push. It adds a fun and efficient touch to Git workflows.
#!/bin/bash
# Get the list of available branches
available_branches=$(git branch --list)
# Prompt to select a branch
echo "🌍 Available branches:"
echo "$available_branches"
read -p "❗ Please enter the branch name to commit to (or press Enter for current branch): " selected_branch
@prabapro
prabapro / measureschool-ga4-ecommerce-boilerplate.json
Created August 5, 2022 10:09
GA4 Ecommerce Boilerplate - GTM Recipe by MeasureSchool
{
"exportFormatVersion": 2,
"exportTime": "2022-08-05 10:09:11",
"containerVersion": {
"path": "accounts/6006227429/containers/90922809/versions/2",
"accountId": "6006227429",
"containerId": "90922809",
"containerVersionId": "2",
"name": "[Praba] GA4 Ecommerce Events Boilerplate by MeasureSchool - v1.0",
"description": "GA4 Ecommerce Events Boilerplate by MeasureSchool.\n\nFor queries, write to [email protected]",

MeasureSchool - ThriveCart Ecommerce Events (UA & GA4)

Instructions - ThriveCart

thrivecart

  1. Copy the contents from 01-base-all-pages.html & paste it on All Pages box in the ThriveCart Product Checkout page - Replace GTM-xxxxx with your GTM container ID - Line 12.

  2. Copy the contents from 02-checkout-page.html & paste it on Checkout Page box.

function() {
var orderData = {{dlv - order-data v1}};
var items = {{dlv - items - v1}};
var actionField = {
id: orderData.id,
affiliation: orderData.affiliation,
revenue: orderData.revenue,
shipping: orderData.shipping,
select
timestamp_micros(event_timestamp) as timestamp_utc, -- converts the timestamp into UTC
format_datetime("%Y-%d-%m %H-%M-%S %Z", (timestamp_micros(event_timestamp)), 'America/New_York') as timestamp_newyork, --timestamp in NY
event_name,
(select value.string_value from unnest(event_params) where key = 'transaction_id') as transaction_id, -- gets the string value
(select value.int_value from unnest(event_params) where key = 'value') as transaction_value, --gets the integer value
(select value.string_value from unnest(event_params) where key = 'currency') as currency,
(select value.string_value from unnest (event_params) where key = 'page_title') as page_title,
(select value.string_value from unnest (event_params) where key = 'page_location') as url
@prabapro
prabapro / gtm-exact-scroll-percentage-jquery.md
Created January 6, 2022 17:30
GTM - Exact scroll percentage using jQuery

Check if jQuery is enabled on the site - running the below snippet on the browser console will return the result.

(function() {
    if (window.jQuery) {  
        // jQuery is loaded
        return("Yeah! JQuery loaded");
    } else {
 // jQuery is not loaded
function exportToBigQuery() {
var projectId = 'learn-big-query-307011'; //GCP Project ID here
var datasetId = 'ga_gbq_data_pipeline_demo'; //GBQ Dataset ID
var tableId = 'ga_codechilli_users_by_country'; //GBQ Table ID
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var values = spreadsheet.getSheetByName('data').getDataRange().getValues();
var csv = generateCSV(values);