Problem of link tracking on AMP pages Via GTM & Google Analytics - google-analytics

I can't track outbound link click tracking on amp pages with Google Tag Manager.
I used before Event Label ${outboundLink} - but now I don't get the link details. Instead of, I get (not set) on Google Analytics.
How can I know what is the problem and how to get data of the link details when click on the link on amp pages?

Before you can consume the user defined AMP variable, "outboundLink", you need to declare the variable as an element level data attribute and set its value. To do this you would decorate your a tag with data-vars-some-arbitrary-variable-name. For your code, ${outboundLink}, you want data-vars-outbound-link="[replace with your IRL]". Once you set the variable, you can consume it with the standard camelCase ${someArbitraryVariableName}.
So <a href="https://stackoverflow.com" data-vars-outbound-link="stackoverflow.com"> will have the AMP variable ${outboundLink} and the value with be "stackoverflow.com".
for more info see https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/analytics-vars.md

Related

Add Google Ads custom variable to the existing Pixel via Google Tag Manager

I've created a Google Ads custom variable client_id and would like to add it to the existing Pixel that is set up on the website via GTM. However, I cannot find any documentation on how to do it via Google Tag Manager. There're instructions on how to
do it by adding a custom variable to an event snippet on the website, but there's no information regarding its setup via GTM.
Does anyone know how to add a Google Ads custom variable to the existing Pixel via GTM? Also, this variable needs to be dynamic as it should pick up different values.
Here's how the existing Google Ads tag looks:
Any suggestions would be helpful. Thank you in advance!

Implementing User-ID With Google Tag Manager

I have added Google Tag Manager to our site, and using the data layer inserted several custom dimensions, including 'user_id'
Data Layer with user_id shown
The Google Analytics variable in Tag Manager is configured to pass these data layer variables into the coresponding dimensions:
Tag Manager Variable & Dimensions in Analytics
I know this is working as I am able to add this as a secondary dimension in Analytics when viewing reports:
Analytics with Dimension Shown
However, the user view that is created when I have set up the User-Id isnt showing anything:
Creating the User View
We installed Tag Manager using the recommended steps:
Installation of Tag Manager
Do we also need to add the 'Global Site Tag Tracking Code'?
How to Implement the User-ID in your tracking code
If not, what am I doing wrong?
You're actually REALLY close. You actually don't need to create the custom dimension.
The correct way is to set the userId field in your GA tag (I did it through a GA variable so it is applied everywhere).
Yes, that is exactly correct (what #XTOTHEL answered above), but for those who are reading this, I found these two blog posts helpful (esp if you are using GTM):
GA UA: https://www.analyticsmania.com/post/google-analytics-user-id-with-google-tag-manager/
GA4: https://www.analyticsmania.com/post/google-analytics-4-user-id/
And of course, the GA docs: https://support.google.com/tagmanager/answer/4565987?hl=en

Use Google Tag Manager to fire an URL with custom parameters when triggered

When someone visits my site, I'd like Google Tag Manager to fire an URL in the background that sends information about the visit to my affiliate network.
For instance: https://mytrackingsoftware.com/c23r42e43223?utm_source={source}&utm_medium={medium}&some_parameter{parameter}
Let's assume I already have those parameters set as variables in GTM. How can I set GTM up to do the above and (hopefully easily) use the paramters already known to GTM?
Use a custom image tag in GTM, set it to trigger on the page that you want. The "image url" field is where you want to do your request. Like so:

GA query parameters breaking link

I'm working on this site k-west.co.uk - if you go to the footer and click the link to Twitter you'll find it doesn't work. Google Analytics has added utm parameters and it seems this breaks Twitter. If you remove the paramters from the url, Twitter works.
How can I tell Google Analytics not to add query parameters to this link? Is there a class or attribute I can add that will do this?
I tried to remove the parameters using JavaScript but as GA only adds the parameters as you click the button, I cannot remove them, I need to prevent GA adding them in the first place.
Thanks
It looks that you're using Google Tag Manager to add Google Analytics functionality to your site and cross-domain tracking is enabled for Analytics tag. But it looks misconfigured as #vinoaj suggested. You need to modify your Google Analytics settings variable to only add cross-domain parameters to the links to target site:
While Auto Links Domain field is blank all the links will be extended with cross-domain tracking parameters.

Google tag manager Track page by content

I created a google analytics account for my website and created google tag manager account too. And both of the accounts are linked and working well.
I have a new requirement which is , my client wants users to allow chance to edit there webpage and create custom templates.
Scenario is ,
User log in to the system
Go to genaral page
Use genaral page or edit genaral page and create custom template for it
Next time user log in to the system and go to the genaral page , User created Custom template appear as genaral page, But same URL
If you can get the point , Same URL but the content is different ,
I applied google tag manager to track those pages, Because of having same URL its tracking as a same url,
But I want to track the page by content and track user if user used my genaral template or custom template.
Hope any one will have a idea to how to create Google Tag or Macro or Rule , Or custom java script for it.
Thanks in advance
By far the best way would be to include a dataLayer variable into your templates that indicated which template is being used. Best to include it above the tag manager code:
<body>
<script>
dataLayer = [{
'template': 'default',
}];
</script>
<!-- Google Tag Manager -->
...
<!-- End Google Tag Manager -->
so it's immediatly available when the GTM code loads. Then create a dataLayer variable in GTM that reads the value for the "template" key from the dataLayer and pass it as a hit based custom dimension to Google Analytics (i.e. in the property settings in GA under "custom definitions" you create a new custom dimension and set the scope to "hit"; in GTM you go to "more settings/custom dimensions", add the numeric index of the dimension you have just created and pass your new dataLayer variable as dimension value). Then you can segment your page hits in Google Analytics based on template type.
I'm sure it would be also possible to track by content (i.e. you could load the content into a js string variable, create a hash value from the string and send that as a custom dimension), but that would mean even fixing typos would result in a new id. Using a variable per template seems much more prudent.
If supposedly your different templates have some ID's in the code - you can use this ID as identifier for the template and create variable to check if the ID is present, then fire it in GA, in similar way as the Eike's description.
But this is the sloppy way, and it's an option if you have no way to create dataLayer push for the new templates, as described by Eike. Otherwise the dataLayer push is the better way to do the job.

Resources