Help using Base SAS procedures

Sending Cost Data to google analytics

Reply
Occasional Contributor
Posts: 9

Sending Cost Data to google analytics

Hi All,

I have never used Proc HTTP to call or post an API before.

I am trying to send a dataset through google analytics Measurement Protocol. I want to post like 10k records back to Google analytics. The dataset  test - looks like:

CID                                Score         Status

709858318.98779              0            only
195215856.02536              05          Res
2045451890.2043              32          only
1065404999.8308              15          Rev

The program I have been trying to use is:


/*** HTTP CALL */
%macro echoResp(fn);
data _null_;
infile &fn;
input;
put _infile_;
run;
%mend;

filename resp temp;
filename in temp;

/* v=1 */
/* &tid=UA-XXXXX-Y ***/
/* &cid=555*/
/* &cm1=95  */
/* &t= */


proc http
url='http://www.google-analytics.com/v=1&tid=UA-UA-XXXXX-Y-1&cid=cid&cm1=0&cd2=only
&t=pageview&dp=%2Fhome'
method='POST'
out=resp
;
run;

/* Echo response content to the log */
%echoResp(resp);

 

This is not working and my confusion is whether I need a specific CID or loop through the data to insert the cid from the table?

Or if anyone has a simple and easy way to send data to google analytics that would be very appreciated.

 

Thanks in advance.

 

Ask a Question
Discussion stats
  • 0 replies
  • 264 views
  • 0 likes
  • 1 in conversation