Using User ID with Google Tag Manager / Analytics
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Hope somebody can help, I'm using GTM to push a userId variable over to google analytics, i can see the data in the chrome console / dataLayer but nothing is showing in the userID view on analytics. I'm using this code on my site at the top of the head:
<script>
dataLayer =
dataLayer.push( 'userId': <%= currentUser.number %> );
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
On GTM i have a Data Layer variable set up as userId (Data Layer version2) and in the tag configuration (fields to set) I have Field Name userId and value userId.
Over on analytics I have set up a UserId view and a Custom Dimension Name of userId (scope is User, Index is 1).
Am I missing something??
thanks.
google-analytics google-tag-manager
add a comment |
Hope somebody can help, I'm using GTM to push a userId variable over to google analytics, i can see the data in the chrome console / dataLayer but nothing is showing in the userID view on analytics. I'm using this code on my site at the top of the head:
<script>
dataLayer =
dataLayer.push( 'userId': <%= currentUser.number %> );
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
On GTM i have a Data Layer variable set up as userId (Data Layer version2) and in the tag configuration (fields to set) I have Field Name userId and value userId.
Over on analytics I have set up a UserId view and a Custom Dimension Name of userId (scope is User, Index is 1).
Am I missing something??
thanks.
google-analytics google-tag-manager
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01
add a comment |
Hope somebody can help, I'm using GTM to push a userId variable over to google analytics, i can see the data in the chrome console / dataLayer but nothing is showing in the userID view on analytics. I'm using this code on my site at the top of the head:
<script>
dataLayer =
dataLayer.push( 'userId': <%= currentUser.number %> );
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
On GTM i have a Data Layer variable set up as userId (Data Layer version2) and in the tag configuration (fields to set) I have Field Name userId and value userId.
Over on analytics I have set up a UserId view and a Custom Dimension Name of userId (scope is User, Index is 1).
Am I missing something??
thanks.
google-analytics google-tag-manager
Hope somebody can help, I'm using GTM to push a userId variable over to google analytics, i can see the data in the chrome console / dataLayer but nothing is showing in the userID view on analytics. I'm using this code on my site at the top of the head:
<script>
dataLayer =
dataLayer.push( 'userId': <%= currentUser.number %> );
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
On GTM i have a Data Layer variable set up as userId (Data Layer version2) and in the tag configuration (fields to set) I have Field Name userId and value userId.
Over on analytics I have set up a UserId view and a Custom Dimension Name of userId (scope is User, Index is 1).
Am I missing something??
thanks.
google-analytics google-tag-manager
google-analytics google-tag-manager
edited Nov 15 '18 at 11:50
DaImTo
47.3k1169249
47.3k1169249
asked Nov 15 '18 at 11:18
Dan ThoryDan Thory
407
407
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01
add a comment |
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01
add a comment |
2 Answers
2
active
oldest
votes
The code / setup I used above does work for showing userId within a userID view on analytics - as Ms.Easy said, you have to wait 24hrs for it to update.
add a comment |
This might not work as you have declared dataLayer.push
method above the GTM container.
You can only declare dataLayer=
method above the GTM container.
To send the user Id to GA, Use the below Code:
<script>
dataLayer = [ 'userId': <%= currentUser.number %> ];
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Now set up the dataLayer
variable and tag in GTM to capture the value and send to GA.
Hope this helps!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318303%2fusing-user-id-with-google-tag-manager-analytics%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The code / setup I used above does work for showing userId within a userID view on analytics - as Ms.Easy said, you have to wait 24hrs for it to update.
add a comment |
The code / setup I used above does work for showing userId within a userID view on analytics - as Ms.Easy said, you have to wait 24hrs for it to update.
add a comment |
The code / setup I used above does work for showing userId within a userID view on analytics - as Ms.Easy said, you have to wait 24hrs for it to update.
The code / setup I used above does work for showing userId within a userID view on analytics - as Ms.Easy said, you have to wait 24hrs for it to update.
answered Nov 16 '18 at 9:03
Dan ThoryDan Thory
407
407
add a comment |
add a comment |
This might not work as you have declared dataLayer.push
method above the GTM container.
You can only declare dataLayer=
method above the GTM container.
To send the user Id to GA, Use the below Code:
<script>
dataLayer = [ 'userId': <%= currentUser.number %> ];
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Now set up the dataLayer
variable and tag in GTM to capture the value and send to GA.
Hope this helps!
add a comment |
This might not work as you have declared dataLayer.push
method above the GTM container.
You can only declare dataLayer=
method above the GTM container.
To send the user Id to GA, Use the below Code:
<script>
dataLayer = [ 'userId': <%= currentUser.number %> ];
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Now set up the dataLayer
variable and tag in GTM to capture the value and send to GA.
Hope this helps!
add a comment |
This might not work as you have declared dataLayer.push
method above the GTM container.
You can only declare dataLayer=
method above the GTM container.
To send the user Id to GA, Use the below Code:
<script>
dataLayer = [ 'userId': <%= currentUser.number %> ];
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Now set up the dataLayer
variable and tag in GTM to capture the value and send to GA.
Hope this helps!
This might not work as you have declared dataLayer.push
method above the GTM container.
You can only declare dataLayer=
method above the GTM container.
To send the user Id to GA, Use the below Code:
<script>
dataLayer = [ 'userId': <%= currentUser.number %> ];
</script>
<script>(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-XXXXXXXX');
</script>
And at the top of the body:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Now set up the dataLayer
variable and tag in GTM to capture the value and send to GA.
Hope this helps!
answered Nov 16 '18 at 10:09
Anuj BAnuj B
2591313
2591313
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318303%2fusing-user-id-with-google-tag-manager-analytics%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you wait 24 hours?
– zborovskaya
Nov 15 '18 at 13:09
No didn't realise there was a delay updating, will check again tomorrow - thanks.
– Dan Thory
Nov 15 '18 at 13:27
Its working now - thanks!
– Dan Thory
Nov 16 '18 at 9:01