Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Source and Medium from ga.js

I have a newsletter page on my website which I'd like to also use to capture some additional information about the user using Google Analytics.

Using the getAll() method from ga.js I can get the referrer URL (if any), however I cannot see the medium or source data. Is this possible to retrieve using their ga.js library?

like image 298
InvalidSyntax Avatar asked Nov 18 '22 01:11

InvalidSyntax


1 Answers

Retrieve specific tracker from the list of trackers you obtained. Use the following to access the fields source and medium. tracker.get('campaignSource') and tracker.get('campaignMedium')

Additional help from below links. Access data from ga object: https://developers.google.com/analytics/devguides/collection/analyticsjs/accessing-trackers

Field reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference

like image 175
user2386411 Avatar answered Dec 04 '22 15:12

user2386411