BookmarkSubscribeRSS Feed
Agogo
Calcite | Level 5

I am trying to send a sas dataset to google analytics for optimisation, has someone done it before or any pointer would be much appreciated.

 

Thank you in advance.

7 REPLIES 7
PGStats
Opal | Level 21

Are you expecting Google to do better than SAS?

PG
Agogo
Calcite | Level 5

Not really, my marketing department wants to use this data optimisation purposes.

It is a handful of leads that are required to be sent back to google Analytics.

Agogo
Calcite | Level 5

Not really, my marketing department wants to use this data optimisation purposes.

It is a handful of leads that are required to be sent back to google Analytics.

ChrisHemedinger
Community Manager

Is this a one-time process?  Or something ongoing?  

 

Perhaps if you provide a link to the Google Analytics documentation that describes how this data is to be formatted/sent, someone here can advise how you might transmit the records from your SAS data set appropriately.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Agogo
Calcite | Level 5

Chris, It will be an ongoing process and ideally automated one so any format that is easier would be good.

My understanding is that to do this programmatically I should use the google Analytics measurement protocol

 

https://developers.google.com/analytics/devguides/collection/protocol/v1/

ChrisHemedinger
Community Manager

@Agogo,

 

Thanks for that reference.  SAS has a procedure called PROC HTTP that allows you to send data to web sites and interact with web-based APIs like this.  I don't have any experience with this Google Analytics API so I can only guess at some things, but here is an example that uses some fields from an example in the Google Analytics developer's guide.

 

%macro echoResp(fn=);
data _null_;
 infile &fn;
 input;
 put _infile_;
run;
%mend;

filename resp temp;
/*
    v=1              // Version.
    &tid=UA-XXXXX-Y  // Tracking ID / Property ID.
    &cid=555         // Anonymous Client ID.
    &t=              // Hit Type.
*/
proc http
 url='http://www.google-analytics.com/v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fhome'
 method='POST'
 out=resp
 ;
run;

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

You would need to form one call per record, or you can create a "batch" style call per the Google Analytics guide to issue multiple records within a single HTTP call.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Agogo
Calcite | Level 5

Thanks Chris, I am going to play with it monday when i am back in the office.

 

very much appreciated

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1149 views
  • 0 likes
  • 3 in conversation