google-analytics

How to test google analytics (garb) API with Rspec?

倖福魔咒の 提交于 2019-12-06 05:03:25
I'm using the garb gem to pull some basic stats, like pageviews, from Google Analytics. Everything's working correctly but I can't figure out the best way to test my API calls. Here's a paired down version of my Analytics class: class Analytics extend Garb::Model metrics :pageviews dimensions :page_path Username = 'username' Password = 'password' WebPropertyId = 'XX-XXXXXXX-X' # Start a session with google analytics. # Garb::Session.login(Username, Password) # Find the correct web property. # Property = Garb::Management::Profile.all.detect {|p| p.web_property_id == WebPropertyId} # Returns the

Pass dynamic event label in Google AMP analytics event tracking

笑着哭i 提交于 2019-12-06 04:45:07
I want to track an event with google analytics when a link is clicked on my AMP html page. Also I want to pass the link(href) as eventLabel while tracking this event. Is there a way to set the link URL as data-* attribute which then can be passed to google analytics event tracking script. Or is there any other way to do this. This is pretty standard thing but Google Analytics for AMP page doesn't cover it. I think what you are asking for was recently made available here . basically, you can use code like <span id="test1" class="box" data-vars-event-label="22"> Click here </span> and then use

Google Tag Manager custom javascript variable based on ecommerce datalayer object

情到浓时终转凉″ 提交于 2019-12-06 04:39:13
I'm trying to calculate the value of the shopping cart based on data contianed in the GTM datalayer ecommerce object. I'm bringing the entire ecommerce object into a datalayer variable so I can work with it in the custom js variable, but I'm unable to make the recursive calculation work. Here's an example of code from the datalayer: { "event": "checkout", "ecommerce": { "checkout": { "products": [ { "name": "coat", "id": "14M", "quantity": 1, "price": "100.00" }, { "name": "pants", "id": "12L", "quantity": 3, "price": "50.00" } ] } } }` My goal is to identifies the number of products in the

Run multiple simultaneous tests with Google Content Experiments API

二次信任 提交于 2019-12-06 04:37:43
问题 I'm trying to use Google Content Experiments API to run several A/B tests simultaneously in the same page (similar to a multivariate test). I've tried just putting all the recommended code for each test one after another, like this: <script src="//www.google-analytics.com/cx/api.js?experiment=8RsNt4b7T0aE8RC2s9R3IA">/script> <script> var chosenVariation = cxApi.chooseVariation(); var pageVariations = [ function() {}, function() { $(".block1").hide(); }, ]; $(document).ready( pageVariations

PHP API for Google Analytics

a 夏天 提交于 2019-12-06 04:33:32
I wanna start using Google Analytics PHP API. I found 2 libraries and I can't understand which one should I use and what is the main difference between them: gapi-google-analytics-php-interface and google-api-php-client P.S. The main reason to use this API is requirement to work with goals. google-api-php-client is for Google API's and not specifically for Google Analytics. gapi-google-analytics-php-interface is a library that connects to your Google Analytics account and extracts data. You should use this client. GAPI (said 'g,a,p,i') is the Google Analytics PHP5 Interface. Would recommend

Multiple properties in one universal Google Analytics code

假如想象 提交于 2019-12-06 04:02:40
问题 I am trying to embed a GA code in my website that is based on the new Universal Analytics method. What I am trying to achieve is to send data to multiple properties from one page. So I have checked the official GA documentation on the new universal GA code and specifically the section about "Working with multiple tracking objects". https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#multipletrackers But so far without success. I have one domain for the standard

Remove all traffic for a specific user agent

爱⌒轻易说出口 提交于 2019-12-06 03:54:58
问题 Is there a way to exclude, from all properties and all views of Google Analytics, the visitors with a specific user agent ? Note: it's not for spam/bot prevention (I already checked the feature Admin > View settings > Bot filtering > Exclude all hits from known bots and spiders ), it's to remove a part of own traffic. I can't use IP filtering because my IP changes all the time, and I use many devices (mobile/desktop/laptop). I also can't use cookies, because often I want to test my website as

Retrieving data from Google Analytics API using .NET/C#

落花浮王杯 提交于 2019-12-06 03:40:01
问题 I'm trying to retrieve data from google analytics with a local console app. Im able to extract some data without having to log in to google account and only using the API. The problem is i'm not getting the right values and im not sure how to format the code to extract the correct values. I wan't to retrieve all visitors within a certain time frame, in this case "2012-01-01" - "2014-02-20". The real number of visitors is like 10 times larger when looking in the Google Analytics dashboard. I'm

Adding Google Analytics to Rails 4.2 app

谁都会走 提交于 2019-12-06 03:29:08
问题 I've got a Rails 4.2 app that I've deployed with Heroku and I've tried to add Google Analytics to it. However, Google Analytics isn't picking up any sessions. Any suggestions why and how to resolve this? CODE /app/layouts/_footer.html.erb: <% if Rails.env.production? %> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode

Why aren't results from Google Analytics Content Experiments showing?

冷暖自知 提交于 2019-12-06 03:13:26
问题 First of all let me quickly run-down my setup for you. We have multiple domains and for that reason I use tracking code which sends the traffic to 2 different profiles at the same time. One profile tracks that specific domain, and the other is a multi-domain profile which collects data from all the domains. This is what the tracking code looks like for the pages on my domain. The UA-XXXXX-11 is the multi-domain account: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-1']); _gaq