Skip to content

Instantly share code, notes, and snippets.

@ryanpraski
ryanpraski / hello_analytics_api_v3_10krows_nosampling_ryanpraski_single_csv.py
Created February 8, 2016 20:24
Export more than 10,000 rows & a solution for the sampling limitations of Google Analytics using Python and the Google Analytics API. Includes functionality to pull data from multiple Google Analytics profiles. This version puts all data for all the profiles into a single csv file.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@ryanpraski
ryanpraski / google_analytics_api_v3_10krows_nosampling_multiple_profiles_ryanpraski.py
Last active February 1, 2024 13:44
A solution for exporting more than 10,000 rows and a solution for the sampling limitations of Google Analytics using Python and the Google Analytics API. Includes functionality to pull data from multiple Google Analytics profiles.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@ryanpraski
ryanpraski / google_sheet_script_removeEmptyRows_removeEmptyColumns.js
Last active September 21, 2017 07:30
Google Sheet Script removeEmptyRows removeEmptyColumns
//Remove All Empty Columns in the Entire Workbook
function removeEmptyColumns() {
var ss = SpreadsheetApp.getActive();
var allsheets = ss.getSheets();
for (var s in allsheets){
var sheet=allsheets[s]
var maxColumns = sheet.getMaxColumns();
var lastColumn = sheet.getLastColumn();
if (maxColumns-lastColumn != 0){
sheet.deleteColumns(lastColumn+1, maxColumns-lastColumn);
@ryanpraski
ryanpraski / adobe_analytics_api_save.segment_method.txt
Last active December 2, 2015 22:49
Adobe Analytics API Create Segment Example- Method Segments.Save
{
"definition":{
"container":{
"type":"hits",
"operator":"equals",
"rules":[
{
"element":"evar47",
"operator":"equals",
"value":"loggedin"