Embed JS in a post

Hi All,

I’m looking for a developer to help embed Google Analytics into a post.

The GA embed API provides the script. Just need to make it work in a post.

Example code:

<!DOCTYPE html>
  <title>Embed API Demo</title>

<!-- Step 1: Create the containing elements. -->

<section id="auth-button"></section>
<section id="view-selector"></section>
<section id="timeline"></section>

<!-- Step 2: Load the library. -->

gapi.analytics.ready(function() {

  // Step 3: Authorize the user.

  var CLIENT_ID = 'Insert your client ID here';

    container: 'auth-button',
    clientid: CLIENT_ID,

  // Step 4: Create the view selector.

  var viewSelector = new gapi.analytics.ViewSelector({
    container: 'view-selector'

  // Step 5: Create the timeline chart.

  var timeline = new gapi.analytics.googleCharts.DataChart({
    reportType: 'ga',
    query: {
      'dimensions': 'ga:date',
      'metrics': 'ga:sessions',
      'start-date': '30daysAgo',
      'end-date': 'yesterday',
    chart: {
      type: 'LINE',
      container: 'timeline'

  // Step 6: Hook up the components to work together.

  gapi.analytics.auth.on('success', function(response) {

  viewSelector.on('change', function(ids) {
    var newIds = {
      query: {
        ids: ids
1 Like

Hi @VincentAlse
I am interested to take this up, sending you a PM

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.