I've enabled enhanced ecommerce on Google Analytics,
then in the code Im setting up a product, and action and then sending an event so the ec package gets sent. Something like:
ga('ec:addProduct', ecproduct);
// detail: a view of product details
ga('ec:setAction', 'detail');
//save to local storage to ensure product consistency across funnels
Cookies.set("ec_prod_"+ecproduct.id, ecproduct);
Cookies.set("ec_cart_prod", ecproduct);
ga('send', 'event', 'Online Purchase', 'Detail');
I have the Google Analytics Debugger extension installed and I can tell that the data is being sent:
But it is not appearing in the analytics ecommerce overview report! I do get reports of the events that I'm sending, though:
Related
How do I report conversion from gtag on server side back to google ads?
My current setup is that I report events from gtag back to google analytics 4 using unique userId (generated in my database and it's unique for each user)
let data = {
client_id: this.getDeviceId(),
user_id: this.userId,
events: [{
name: eventName,
params: props,
}]
}
... then send it as payload to the tracking url to the ga4 tracking url:
https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=...
Now I launched google ads and want to report purchase and renewals as conversion.
So I imported my target event from GA4 to google ads as an offline event.
But to my understanding, in order to properly link the user back to google ads, I also need to pass gclid in gtag when I report the event/conversion, but how to do that?
Should I just add gclid as property in data? Is it documented anywhere?
I was using the below doc link in order to setup gtag tracking on the server:
https://developers.google.com/analytics/devguides/collection/protocol/ga4/user-properties?client_type=gtag
I need to track userid and currentTime using Google Analytics.
Google Analytics does not offers user PII data.So I am doing following steps-
Step1-
In Order to do that I created 2 new dimention by the google analytics admin panel in under the property section for hits.
Admin->Property->CustumDefinetion->CustomDimention->AddNew
Step2- Than I changed my script by ajax call and added this data in GoogleAnalytics Script in the page which I am tracking
ga('create', 'UA-57411451-1',{'userId':customUserId });
ga('set', 'dimension1', customUserId);
ga('set', 'dimension2', entryTime);
Step3- Now I am sending GET request to GoogleAnalytics using ga-dev-tool.
Result- This is not giving me any data.May be there are very less user on the current page.
Questions-
Am I missing any thing or Is there any better approach for same.
How much delay GoogleAnalytics causes in reflecting data.
Below is the screenshot of google analytics ga-dev-tool result.
We are trying to attribute user actions that happen after a user has signed in to the marketing channel they originated from. To do this, we use the standard Google Analytics JS library as well as the Measurement Protocol. Events get tracked in Google Analytics and they are visible in the events view. However, they do not get attributed to the correct campaign and only show up under the Direct channel.
Our process is as follows:
The user gets tracked with front end Google Analytics JS on our site:
ga('create', ‘UA-XXXXX-Y’, 'auto');
ga('send', 'pageview');
A userId gets assigned to the user in Google Analytics as soon as they sign up:
ga('create', ‘UA-XXXXX-Y’, 'auto');
ga('set', 'userId', 'fe8220b3');
ga('send', 'pageview');
Once a certain action we would like to track happens, we send a GET request to the Measurement Protocol with the following params:
v: 1,
t: 'event',
tid: ‘UA-XXXXX-Y’,
cid: ‘555’,
uid: ‘fe8220b3’,
ec: ‘backend_action’,
ea: ‘action’
This correctly tracks the event, but does not associate it with the user. As far as I understand, since we have provided the same UserId in our params that we did when identifying the user, the attribution should happen automatically in Google Analytics. Am I misunderstanding how this works?
Whether this code is fine to implement for UA to track hashchange Urls:
ga ('send', 'pageview', {
'page': location.pathname+location.search+location.hash,
'title': location.pathname+location.search+location.hash});
How many pageview requests it would record in GA everytime the event fire?
Every time that line of code executes, one Google Analytics Pageview will fire. See here for more details on Pageview tracking.
Also, this Chrome extension might be helpful. It prints info on any Google Analytics hits sent to the JS console.
Background
We have a number of websites that we maintain and we have Google AdWords Campaigns running to drive traffic to these sites.
For Example:
www.example1.co.uk
www.example2.co.uk
www.example3.co.uk
After browsing these sites, a customer will be redirected to our E-Commerce platform if they decide to make a purchase (this is where the conversion happens):
www.example-checkout.com
Current Google Analytics Setup
Our current Google Analytics Setup looks like this:
www.example1.co.uk, www.example2.co.uk, www.example3.co.uk
ga('create', 'UA-12345678-1', 'auto', {'name': 'globalTracker'});
ga('globalTracker.send', 'pageview');
ga('globalTracker.require', 'linker');
ga('globalTracker.linker:autoLink', ['example-checkout.com'], true);
www.example-checkout.com
All Pages
ga('create', 'UA-12345678-1', 'auto', {'allowLinker': true, 'name' : 'globalTracker'});
ga('globalTracker.send', 'pageview');
Checkout Page Only
The checkout/confirmation/thank you page contains additional calls to load the Google Analytics E-Commerce plugin and post the details of the transaction that has occurred.
ga('create', 'UA-12345678-1', 'auto', {'allowLinker': true, 'name' : 'globalTracker'});
ga('globalTracker.send', 'pageview');
ga('globalTracker.require', 'ecommerce', 'ecommerce.js');
ga('globalTracker.ecommerce:addTransaction', {
'id': '${transactionID}',
'affiliation': '${affiliation}',
'revenue': '${revenue}',
'shipping': '${shipping}',
'tax': '${tax}'
});
ga('globalTracker.ecommerce:send');
What Works
The E-Commerce tracking code appears to work and conversions are recorded. In Google Analytics we can see that we received traffic/clicks from our AdWords campaigns which suggests that the _ga cookie is being correctly passed cross-domain from www.example1.co.uk to www.example-checkout.com (in fact I have verified this using the Chrome Developer Tools / Google Analytics Debugger Plugin).
Problem
The problem is that the conversions are never attributed to the AdWords Campaign & AdGroup. The source of the conversion is always a referral (E.g. from www.example1.co.uk).
What am I missing? I want to see the conversions attributed to the AdWords campaign. I.e. in the "Acquisition -> Campaigns" section of Google Analytics.
Any pointers are greatly appreciated.
You do not mention that you use any decorator functions (i.e. functions that add the ga parameter to outgoing links, forms etc.) and allowLinker does not do this automatically. So it should be not possible that cross domain tracking works at all (i.e. both domains will be tracked but on changing the domain the user will start a new tracking session). (UPDATE: Sorry, I did not see the autolinker plugin in the code, so ignore this paragraph).
Plus you need to add both domains to the referrer exclusion list in the property settings (this will remove the referrer no matter what, so make sure that the client id is passed on before you do that).
Unless you have used decorators without saying so in the question this is most likely your problem. Look into the outgoing urls if the ga parameter is appended when switching domains and make sure that the ga code on the other domain does actually receive the parameter (i.e. if there are redirects make sure they retain the parameter).