Created
June 26, 2016 14:42
-
-
Save LindaLawton/08f3b6b874dfd73eefc06c6244d0005c to your computer and use it in GitHub Desktop.
sends event to Google Analytics event webhook
This file contains hidden or 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
/* | |
* Declaring the variables. | |
*/ | |
char MyIp[16] ; | |
char AccountId[20] = "UA-xxxx-1"; | |
char cid[10] = "123"; | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
char data[1000] ; | |
sprintf(data,"{ \"v\": \"1\",\"tid\": \"%s\",\"cid\": \"%s\", \"t\": \"event\",\"cd\": \"LivingRoom\",\"an\": \"ParticleTesting\",\"uip\": \"%s\" ,\"cm1\": \"%u\", \"ec\": \"Catagory\", \"ea\": \"Action\",\"ev\": \"%u\"}" | |
,AccountId | |
,cid | |
,WiFi.localIP().toString().c_str() | |
,1 | |
,1); | |
Particle.publish("AnalyticsEvent", data, PRIVATE); | |
delay(10000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment