Skip to content

Commit

Permalink
Use Measurement Protocol instead of Galvanize.php
Browse files Browse the repository at this point in the history
  • Loading branch information
chadsmith committed Jun 17, 2013
1 parent d5db8be commit e734f9d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 338 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.DS_Store
*~
333 changes: 0 additions & 333 deletions applets/track/Galvanize.php

This file was deleted.

20 changes: 15 additions & 5 deletions applets/track/twiml.php
Expand Up @@ -9,15 +9,25 @@
$to = normalize_phone_to_E164($_REQUEST['To']);
$url = str_replace(array('%caller%', '%number%'), array($from, $to), $url);
$title = str_replace(array('%caller%','%number%'), array($from, $to), $title);

include_once('Galvanize.php');
@$GA = new Galvanize($account);
@$GA->trackPageView($url, $title);
$ch = curl_init('http://www.google-analytics.com/collect');
$fields = array(
'v' => 1,
'tid' => $account,
'cid' => substr($from, 1),
't' => 'pageview',
'dp' => $url,
'dt' => $title
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
curl_exec($ch);
curl_close($ch);
}

$response = new TwimlResponse;

if(!empty($next))
$response->redirect($next);

$response->respond();
$response->respond();

0 comments on commit e734f9d

Please sign in to comment.