Execute Google Analytics Functions in addition to Google Tag ManagerGoogle Tag Manager with AngularJS?Google Tag Manager + Universal Analytics does not fire for outbound linksGoogle Analytic Reporting and Google Tag Manager - Double Counting VisitsGoogle Analytics Custom Events not firing when using Google Tag ManagerExisting Google Analytics events and Google Tag ManagerAdd Google Analytics to iOS App through Google Tag managerMoving to Google Tag Manager broke our virtual pageviewsGoogle Tag Manager Preview: Tags Fired on Events, not showing in AnalyticsVirtual Pageviews in Google Tag ManagerTracking WordPress tags in Google Analytics with Google Tag Manager
Why are flying carpets banned while flying brooms are not?
Who or what determines if a curse is valid or not?
How do you send money when you're not sure it's not a scam?
In this iconic lunar orbit rendezvous photo of John Houbolt, why do arrows #5 and #6 point the "wrong" way?
How do you name this compound using IUPAC system (including steps)?
Three Subway Escalators
Why do jet engines sound louder on the ground than inside the aircraft?
How can I help our ranger feel special about her beast companion?
Project Euler # 25 The 1000 digit Fibonacci index
Why are there few or no black super GMs?
Applying for jobs with an obvious scar
What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?
Inscriptio Labyrinthica
Making a Dataset that emulates `ls -tlra`?
Is it possible to target 2 allies with the Warding Bond spell using the Sorcerer's Twinned Spell metamagic option?
What is this green alien supposed to be on the American covers of the "Hitchhiker's Guide to the Galaxy"?
Why is regex [0-9]0,2 not greedy in sed?
How to belay quickly ascending top-rope climbers?
Why would word of Princess Leia's capture generate sympathy for the Rebellion in the Senate?
Why is Google approaching my VPS machine?
Why don't humans perceive sound waves as twice the frequency they are?
To what extent asymmetric cryptography secures bitcoin transactions?
Do pedestrians imitate auto traffic?
Why does a tetrahedral molecule like methane have a dipole moment of zero?
Execute Google Analytics Functions in addition to Google Tag Manager
Google Tag Manager with AngularJS?Google Tag Manager + Universal Analytics does not fire for outbound linksGoogle Analytic Reporting and Google Tag Manager - Double Counting VisitsGoogle Analytics Custom Events not firing when using Google Tag ManagerExisting Google Analytics events and Google Tag ManagerAdd Google Analytics to iOS App through Google Tag managerMoving to Google Tag Manager broke our virtual pageviewsGoogle Tag Manager Preview: Tags Fired on Events, not showing in AnalyticsVirtual Pageviews in Google Tag ManagerTracking WordPress tags in Google Analytics with Google Tag Manager
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
When using the Google Tag Manager, is it possible to track some things the old way in addition to using the GTM?
For example, I use GTM in order to fire a page view.
However, I want to fire another page view, when a user clicks a button, also known as a virtual page view.
The button in question doesn't have an ID and I don't trust the othet agency, which handles these buttons to consistently keep the same IDs for these elements. So I would rather have them be responsible for these types of page views.
The code for the virtual page view would look something like that:
ga('send',
hitType: 'pageview',
page: 'button2'
);
Since the tracker is already initialized by GTM, I would only have this code outside GTM.
Would this work if all other google analytics related things run over gtm and where should I put this code in this case? Somewhere after the GTM code on the page I'd imagine?
google-analytics google-tag-manager
add a comment |
When using the Google Tag Manager, is it possible to track some things the old way in addition to using the GTM?
For example, I use GTM in order to fire a page view.
However, I want to fire another page view, when a user clicks a button, also known as a virtual page view.
The button in question doesn't have an ID and I don't trust the othet agency, which handles these buttons to consistently keep the same IDs for these elements. So I would rather have them be responsible for these types of page views.
The code for the virtual page view would look something like that:
ga('send',
hitType: 'pageview',
page: 'button2'
);
Since the tracker is already initialized by GTM, I would only have this code outside GTM.
Would this work if all other google analytics related things run over gtm and where should I put this code in this case? Somewhere after the GTM code on the page I'd imagine?
google-analytics google-tag-manager
add a comment |
When using the Google Tag Manager, is it possible to track some things the old way in addition to using the GTM?
For example, I use GTM in order to fire a page view.
However, I want to fire another page view, when a user clicks a button, also known as a virtual page view.
The button in question doesn't have an ID and I don't trust the othet agency, which handles these buttons to consistently keep the same IDs for these elements. So I would rather have them be responsible for these types of page views.
The code for the virtual page view would look something like that:
ga('send',
hitType: 'pageview',
page: 'button2'
);
Since the tracker is already initialized by GTM, I would only have this code outside GTM.
Would this work if all other google analytics related things run over gtm and where should I put this code in this case? Somewhere after the GTM code on the page I'd imagine?
google-analytics google-tag-manager
When using the Google Tag Manager, is it possible to track some things the old way in addition to using the GTM?
For example, I use GTM in order to fire a page view.
However, I want to fire another page view, when a user clicks a button, also known as a virtual page view.
The button in question doesn't have an ID and I don't trust the othet agency, which handles these buttons to consistently keep the same IDs for these elements. So I would rather have them be responsible for these types of page views.
The code for the virtual page view would look something like that:
ga('send',
hitType: 'pageview',
page: 'button2'
);
Since the tracker is already initialized by GTM, I would only have this code outside GTM.
Would this work if all other google analytics related things run over gtm and where should I put this code in this case? Somewhere after the GTM code on the page I'd imagine?
google-analytics google-tag-manager
google-analytics google-tag-manager
asked Mar 26 at 11:09
user1721135user1721135
5,5397 gold badges26 silver badges51 bronze badges
5,5397 gold badges26 silver badges51 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push(
event : 'virtualPageView',
virtualPagePath : 'button2'
);
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
- Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
- Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
- You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely,
pagevariable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
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%2f55355697%2fexecute-google-analytics-functions-in-addition-to-google-tag-manager%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push(
event : 'virtualPageView',
virtualPagePath : 'button2'
);
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
- Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
- Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
- You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely,
pagevariable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
add a comment |
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push(
event : 'virtualPageView',
virtualPagePath : 'button2'
);
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
- Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
- Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
- You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely,
pagevariable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
add a comment |
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push(
event : 'virtualPageView',
virtualPagePath : 'button2'
);
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
- Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
- Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
- You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely,
pagevariable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
Google Tag Manager (GTM) by default uses a random name for each tracker, generated for each Universal Analytics tag. There is a possibility to use fixed name for trackers, which is highly discouraged. This means, that you might have difficulties to identify the proper tracker to use, when sending your additional pageview data.
There are however other methods to send virtual pageviews using GTM, where you can benefit from your existing Analytics settings, defined in Google Tag Manager. (Preferably by using Google Analyitcs Settings variable.)
As far as I understand, you have control over the code, to run some JavaScript on the relevant click event.
So instead of directly invoking the ga object, you can send the desired data to GTM, with a call like this:
dataLayer.push(
event : 'virtualPageView',
virtualPagePath : 'button2'
);
Obviously, there are a couple of things you need to set up in GTM, which will be able to act on this event, and send the pageview to Google Analytics.
- Create a variable that points to virtualPagePath dataLayer variable, so the newly pushed value could be reused
- Create a custom event trigger, that can be used with one or more tags. The event name should match your given event name, virtualPageView in my example.
- You need an Universal Analytics tag, which will send the pageview. This tag should be fired by your new custom event trigger, and should have an extra setting compared to your regular pageview tag. Namely,
pagevariable within the Fields to set block should point to the newly created dataLayer variable, that contains your virtual page path.
This way, Google Tag Manager will take care of creating the tracker for you, sending the hit to Google Analytics, and using the virtual page path variable provided by you, instead of the URL in the browser address bar.
answered Mar 26 at 13:26
kgrgkgrg
1,0285 silver badges11 bronze badges
1,0285 silver badges11 bronze badges
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
add a comment |
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
I don't intend to reference a tracker at all in the virtual page view. I would think that it will be counted towards whatever tracker is initiated?
– user1721135
Mar 26 at 19:20
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
My understanding is, that GTM creates only named trackers, therefore no default (t0) tracker will be created. As no default tracker is created, you must provide a tracker name. Therefore, you need to now the names, or somehow query and reference them, in order this to work, only by using ga() call directly from JavaScript. Reference: developers.google.com/analytics/devguides/collection/…
– kgrg
Mar 26 at 20:28
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
That makes sense. Data Layer seems to be the way to go then.
– user1721135
Mar 26 at 21:49
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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%2f55355697%2fexecute-google-analytics-functions-in-addition-to-google-tag-manager%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