Code Monkey home page Code Monkey logo

cant-dutch-this's Introduction

Predictive Prefetching Demo

An example site showing how to do predictive prefetches with 11ty.

Getting Started

1. Clone this repository:

git clone [email protected]:shortdiv/cant-dutch-this.git my-first-predictive-prefetch

2. Navigate to the directory

cd my-first-predictive-prefetch

Specifically have a look at .eleventy.js to see if you want to configure any Eleventy options differently.

3. Install dependencies

npm install OR yarn 

4. Edit _data/metadata.json

5. Run Eleventy

npm run build OR yarn build

Or build and host locally for local development

npm run serve OR yarn serve

Or build automatically when a template changes:

npm run watch OR yarn watch

Or in debug mode:

DEBUG=* npx eleventy

Authentication Notes

Create Your Credentials

Create a Service Account

Go to the Credentials page in the Google APIs console.

If you don't have an existing project, click "Create" to create a new project. Otherwise, select an existing project from the project dropdown.

Select "Service Account key" from the "Create credentials" dropdown.

Fill out the form for creating a service account key:

Service account dropdown: Select "New Service Account". Service account name: Create a service account a name. Role: Select "Service Accounts" > "Service Account User". Service account ID: Leave as is. Key type: Select P12 key. Click Create.

Setup Your Private Key

Note the private key password, you'll need this when you're converting your password to a pem file.

Move this key into the root directory for this project, outside of /src.

Generate a *.p12 certificate by running this command from the directory for this project:

$ openssl pkcs12 -in *.p12 -out key.pem -nodes -clcerts

Configure GA

You now need to add this service account to GA for the proper permissions.

In your GA account, create a new user and add the necessary permissions.

Add a new user. (Admin > User Management > + > Add New Users) Email Address: [email protected].

Permissions: Select "Read & Analyze."

Note that you may need to Enable the Google Analytics Reporting API in your project

Configure env vars

We'll need to now configure our env variables. To do this in 11ty, we'll lean on nodeenv, which should alr be a dependency in this project. To take advantage of this, add VIEW_ID and SERVICE_ACCOUNT to a .env file in your root dir. You can find these values in the view column of the accounts dropdown in GA.

VIEW_ID=12345678 SERVICE_ACCOUNT_EMAIL=cant-dutch-this@some-example-account-123456.iam.gserviceaccount.com

cant-dutch-this's People

Contributors

denmch avatar dhoman avatar kitt avatar mathiasbynens avatar nhoizey avatar nick-novak avatar nilsmielke avatar onezerodigits avatar shortdiv avatar zachleat avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

radum

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.