Git Product home page Git Product logo

ga-serverless-streaming's Introduction

Google Analytics Serverless Hit Streaming to Google Cloud

This is not an officially supported Google product.

This solution sends hits directly to a Cloud Function trigger URL, which then uses Pub/Sub and Dataflow to write hits to a table in BigQuery. This table is not date partitioned. Hit data should be available in BigQuery in near real-time.

Requirements

Implementation

  1. Navigate to your Google Cloud project and open Cloud Shell
  2. Enter the following into Cloud Shell
rm -rf ga-serverless-streaming && git clone https://github.com/google/ga-serverless-streaming.git && cd ga-serverless-streaming && bash deploy.sh

This will create the following: a cloud function, a cloud storage bucket, a pub/sub topic, and BigQuery dataset and table, and a dataflow job.

  1. If you are using analytics.js or Google Tag Manager, take one of the following steps:
    1. Google Tag Manager
      1. Enable the built-in referrer variable if it is not already enabled
      2. Create a new custom JavaScript variable in your Google Tag Manager container.
      3. Copy the code from /task_override/customJSVariable.js and paste it into the new custom JavaScript variable
      4. Replace “CLOUD_FUNCTION_TRIGGER_URL” with the actual cloud function trigger URL.
      5. Add a new field to the Google Analytics Settings variable in the Tag Manager Container. The field name should be “customTask”. The field value should be the custom JavaScript variable that was created.
      6. Save and publish the container.
    2. Analytics.js 7. Copy the code from /task_override/customGAFunction.js and paste it into the analytics.js snippet between the create and send methods. 8. Replace “CLOUD_FUNCTION_TRIGGER_URL” with the actual cloud function trigger URL. 9. Deploy the code.

After following the above steps, you should begin to see Google Analytics data in your newly created BigQuery table.

ga-serverless-streaming's People

Contributors

b-kuehn avatar mikebrickl-google avatar pgilmon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.