c_cpp 谷歌事件,track.ino

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 谷歌事件,track.ino相关的知识,希望对你有一定的参考价值。

// Copyright Nat Weerawan 2015-2016
// MIT License

#include <ESP8266WiFi.h>
#include <WiFiConnector.h>
#include <ESPert.h>

WiFiConnector *wifi;
ESPert espert;
#define WIFI_SSID        "Nat"
#define WIFI_PASSPHARSE  "devicenetwork"
uint8_t SMARTCONFIG_BUTTON_PIN = 2;

const char *host = "www.google-analytics.com";
const int httpPort = 80;

    String path = "/collect?v=1&t=event&tid=UA-53466330-1&cid=hello&dh=www.cmmakerclub.com&ec=ESPresso%20Lite&ea=Motion%20Sensor&cm5=1&el=Move!";
    espert.println( ">>" + espert.wifi.getHTTP( host, path.c_str() ) + "<<" );



#include "init_wifi.h"

void init_hardware()
{
  Serial.begin(115200);
  delay(1000);
  Serial.println();
  Serial.println();
  Serial.println();
  Serial.println();
  Serial.println("will be started in 500ms..");
  espert.init();
  delay(500);
}

void setup()
{
  init_hardware();
  wifi = init_wifi(WIFI_SSID, WIFI_PASSPHARSE, SMARTCONFIG_BUTTON_PIN);

  Serial.println("BEING CONNECTED TO: ");
  Serial.println(String(wifi->SSID() + ", " + wifi->psk()));
  Serial.print("SMARTCONFIG PIN: ");
  Serial.println(SMARTCONFIG_BUTTON_PIN);
  Serial.print("CORE FN()");
  Serial.println(String(WiFi.SSID() + ", " + WiFi.psk()));
  Serial.print("OK ?");

  wifi->on_connecting([&](const void* message)
  {
    Serial.print("STATE: CONNECTING -> ");
    Serial.println(wifi->counter);
    delay(500);
  });

  wifi->on_connected([&](const void* message)
  {
    // Print the IP address
    Serial.print("WIFI CONNECTED WITH IP: ");
    Serial.println(WiFi.localIP());

    espert.println("Button: On");
    espert.led.on();
    espert.println( "Connecting..." );
    String path = "/collect?v=1&t=event&tid=UA-????????-1&cid=hello&dh=www.cmmakerclub.com&ec=ESPresso%20Lite&ea=Motion%20Sensor&cm5=1&el=Move!";
    espert.println( ">>" + espert.wifi.getHTTP( host, path.c_str() ) + "<<" );
//    espert.led.on();
    ESP.deepSleep(999999 * 1000000);
  });

  wifi->connect();

}

void loop()
{
  espert.loop();
  wifi->loop();
}

以上是关于c_cpp 谷歌事件,track.ino的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 运行MUD范围的事件。

c_cpp cpp中的新事件 - 反应编程

c_cpp esp8266-GA-事件tracking.ino

c_cpp eesp8266-GA-的实时事件tracking.ino

c_cpp 代码用muons浏览Pythia事件并使用一些玩具MC测试对背景mehtods

如何从单个谷歌帐户的多个谷歌日历中获取所有事件?