Most of my website traffic come from adwords, and fill a form to get called.
When A user fill a form, I have a customer created on my database.
For my business strategy, I want to know how much I payed for that lead, and how much benefit I make with it after the call.
For that I think I have to link analytics visitors and my customers directly.
I am searching for a way to put an analytics visitor ID on the request form or something like this...
You would need to get the visitor id and pass it into either a custom variable (ga.js) or custom dimension (analytics.js).
To get the visitor id for Google Analytics (ga.js) *I got this code from How to obtain Google Analytics visitor unique id? SO Answer:
_gaq.push(function(){
var tracker = _gat._getTrackers()[0];
var visit_code = tracker._visitCode();
console.log(visit_code);
});
To get the visitor id for Universal Analytics (analytics.js) *More documentation on this in Google's documentation:
ga(function(tracker) {
var clientId = tracker.get('clientId');
});
I've used this before, too:
ga.getAll()[0].get('clientId');
The best strategy in your case is:
Get user ID from GA or UA(as desribed advisor above)
Send user ID to database
Set up user ID as custom variable(in Googl Analytics) or custom dimension(in Universal Analytics)
Set up custom reports, where you can segment your visitors by their ID's
Related
I want to send these information title, target amount, category, account name to GA for every user who creates a page in our website. And if anyone make transaction on that page I want to generate a revenue of 5% based on the transaction amount for every transaction. I've no clue how to do that.
So far what I've achieved is I set up the service account by following this link and create a custom dimension. Playing with the code snippet I can update the name of the dimension and other things but not sure how to send an object value with all the fields that I need in this custom dimension. My question is if I call this again will it update and replace the old value with the new value? I don't want that. Every time I want to insert a new value in the old value. Shall I need another dimension and what if I want to relate this custom dimension data to ecommerce later on. How can I do that?
try:
analytics.management().customDimensions().update(
accountId='123456',
webPropertyId='UA-123456-1',
customDimensionId='ga:dimension2',
body={
'name': 'Campaign Group',
'scope': 'SESSION',
'active': True
}
).execute()
Can someone please suggest me what should I do here.
you use the measurement protocol to send data to google analytics. The google analytics management api is only for managing your google analytics account.
POST /collect HTTP/1.1
Host: www.google-analytics.com
payload_data
This article should help you achieve what you want.
Basically the custom dimensions in your url should be like cd1, cd2 so on...
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#customs
Here is a code sample that might help
https://www.simoahava.com/analytics/13-useful-custom-dimensions-for-google-analytics/#23-payload-length
I am currently trying to send a hit to Google Analytics from my CRM. I have been successful in sending events and purchase as well as products etc. However, when I try to send through a custom dimension I am not seeing this dimension within the user explorer section of Google Analytics.
My example case as follows:
I go to the Google Analytics Hit builder to build a prototype hit for this interaction found here
I send through an event to Analytics as follows; this contains the all important custom dimension:
v = 1
t = event
tid = {{Analytics account ID}}
cid = {{Random string}}
ec = Offline sales
ea = Completed sale
el = Oflline sale completed
ni = 1
cd4 = Sale made
(Don't run the above, you need to enter it into the respective fields in the hit builder)
I validate this hit and as you can see below it will show valid and will send
Image of valid hit
The event shows up in the real time events
However, the custom dimension never shows up in Analytic's user explorer
Could someone please assist?
Since you specifically mention the user explorer report my educated guess would be that your custom dimension is not user scope (which is the only scope the user explorer will show).
Look if you can select them as secondary dimension in your standard reports or build a custom report (or rather more straightforward, check the scope of your dimension in the property settings)
when somebody register on my website, Google Analytics genrate a new USER ID form him. How can I label/track generated USER_IDs which came from certain campaign (i.e. form certain custom URL with utm parameters)?
Thx for help.
In the first step you should push the UID (or CID) as a Dimension into your GA Account. So you are able to export the UID/CID through the API (or CSV). Here is a article how to do this: https://productforums.google.com/forum/#!topic/tag-manager/lcTvzfvcTvU;context-place=topicsearchin/tag-manager/category$3Aadvanced-setup--implementation%7Csort:relevance%7Cspell:false
If you have the ID as a Dimension you can build a Segment containing your Campaign. In your reports you now see the IDs.
Another solution would be to fire the dimension with the IDs just if a User is on a page containing the specific parameters.
I'm using the following tutorial, http://www.lunametrics.com/blog/2014/03/04/tracking-offline-transactions-universal-analytics/ which tells us how to add a transaction manually using a url like the following:
http://www.google-analytics.com/collect?v=1&tid=UA-123456789-1&cid=75839030.509493873&t=transaction&ti=52ea5aab1f0c2&tr=1100&cd1=52ea5a8bc6a4a
This works ok. However, the eCommerce part of GA does not register a conversion, so it's not possible to use the multi channel funnels report.
I'm wondering is there a way to register a sale similar to how a shopping cart would on a webpage? Would I have to add in the "clientId" for the customer, into the cart so the sale can be recorded against all the other actions in GA?
OR am I doing something wrong? Such as not registering an item? Would this trigger the ecommerce conversion to register?
Either way, somehow the ecommerce tag is not firing, so I can't record multi channel funnels based on clientId
You need save clientId in custom dimensions and in your site (it can be hide field, for example)
If you send transaction with use real clientid (send cid and cd# parameters) = this transaction will be linked with this user and all actions with this cid
On my practice better send t=event&ec=ecommerce&ea=purchase&pa=purchse&item...
With this method I have all data in ecommerce reports
I am new to GA & GTM. I want to track users session/visit activity like page views,document download etc. whatever activity user performs during the session/visit. In Omniture I do activity using evar variable. How can I do the same with GA & GTM.
Going through the document on internet I tried to do this using 1st party cookie variable in GTM. but it is not working. when i see the value for cookie variable it showing undefined and also for return type.
A
You don't need to set a 1st party cookie as GA will do this itself when you put the tag on the website. Its a lot less setup and has more metrics out of the box than Adobe Analytics. In an aggregated fashion the activites you mention can be tracked via event tracking.
If you are looking to also track this on an individual level, then also set a user custom dimension or the userId parameter unique for each user. This will then be associated with the out of the box metrics as above, that you can access via a custom report.
Logical for your question is:
When users authenticate, the user ID should be stored in dataLayer
When subsequent Universal Analytics tags are fired, the &uid key
should first check if the User ID is in dataLayer
If it is, then a cookie is written in the user’s browser with this
User ID, and finally the value is returned to the tag
If the User ID is not in dataLayer, GTM checks if it’s stored in a
cookie, and if it is, the cookie value is returned
If there is no such cookie, nothing is returned and the User ID
parameter will not get sent
Check this post