i'm setting userid tracking in google analytics. google's documentation displays piece of code push userids analytics:
ga('create', 'ua-xxxx-y', { 'userid': 'user_id' }); ga('send', 'pageview');
however, when i'm in google analytic's settings area, displays following piece of code include userids.
ga(‘set’, ‘&uid’, {{user_id}}); // set user id using signed-in user_id.
what difference between set , create? both achieve same result?
both of them should work. including user id in 'create' call includes setting well.
ga('create', 'ua-xxxx-y', {'userid': 'user_id'}); ga('send', 'pageview');
is equivalent to
ga('create', 'ua-xxxx-y'); ga('set', '&uid', {{user_id}}); // set user id using signed-in user_id. ga('send', 'pageview');
if copy , paste provided in ga, need change smart quotes straight quotes, because smart quotes break ga.
Comments
Post a Comment