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
"""geometry.py: | |
Conversions between WGS84, Cartesian, Mercator and TMS coordinates and bounding boxes, | |
useful for converting geographic view ports as generated by Google Earth to TMS bounding boxes | |
""" | |
import math | |
__author__ = "Martin Loetzsch" | |
__licence__ = "Apache 2.0" |
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
cat text/bigquery-example-query.sql | bq query --nouse_legacy_sql | |
Waiting on bqjob_r1213acb52d17011a_0000016cfc7967d0_1 ... (0s) Current status: DONE | |
+-----+------------------------------------------------------------------------------+ | |
| n | url | | |
+-----+------------------------------------------------------------------------------+ | |
| 109 | https://www.project-a.com/de/offline | | |
| 108 | https://www.project-a.com/en/offline | | |
| 93 | https://www.project-a.com/en | | |
| 36 | https://www.project-a.com/ | | |
| 34 | https://www.project-a.com/en/about-us/who-we-are | |
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 | |
relevant_session AS ( | |
SELECT | |
session_id, | |
timestamp | |
FROM | |
`pav-analytics.server_side_tracking.project_a_website_events` | |
WHERE | |
REGEXP_CONTAINS(url, '(?i)jobs/data-engineer-data-scientist') | |
AND device_brand != 'Spider') |
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 base64 | |
import functools | |
import json | |
import geoip2.database | |
from google.cloud import bigquery | |
from ua_parser import user_agent_parser | |
@functools.lru_cache(maxsize=None) |
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
{ | |
"visitor_id": "10d1fa9c9fd39cff44c88bd551b1ab4dfe92b3da", | |
"session_id": "9tv1phlqkl5kchajmb9k2j2434", | |
"timestamp": "2019-12-16T16:03:04+00:00", | |
"url": "https://www.project-a.com/en/career/jobs/data-engineer-data-scientist-m-f-d-4072020002?gh_jid=4082751002&gh_src=9fcd30182&&utm_medium=social&utm_source=linkedin&utm_campaign=buffer", | |
"host": "www.project-a.com", | |
"path": [ | |
"en", | |
"career", | |
"jobs", |
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
<?php | |
require 'vendor/autoload.php'; | |
// this cookie is set when not present | |
$cookieName = 'visitor'; | |
// retrieve visitor id from cookie | |
$visitorId = array_key_exists($cookieName, $_COOKIE) ? $_COOKIE[$cookieName] : null; |
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
{ | |
"visitor_id": "10d1fa9c9fd39cff44c88bd551b1ab4dfe92b3da", | |
"session_id": "9tv1phlqkl5kchajmb9k2j2434", | |
"timestamp": "2018-12-16T16:03:04+00:00", | |
"ip": "92.195.48.163", | |
"url": "https://www.project-a.com/en/career/jobs/data-engineer-data-scientist-m-f-d-4072020002?gh_jid=4082751002&gh_src=9fcd30182&&utm_medium=social&utm_source=linkedin&utm_campaign=buffer", | |
"host": "www.project-a.com", | |
"path": [ | |
"en", | |
"career", |