Decoding a base64 url in Google Analytics - google-analytics

I currently have landing pages taking the following shape :
http://rootdomain/index.html?ref=[base64encoded-ref]&text=[base64encoded-text]
When I watch my stats in google analytics, I have urls looking like
http://rootdomain/index.html?ref=c3RhY2tvdmVyZmxvdw==&text=bWFyd2Fubg==
but I'd like to see
http://rootdomain/?index.html?ref=stackoverflow&text=marwann for example.
Any idea how to achieve this?

Oki so you can do this, but it can be tricky, so be careful.
Without GTM:
So on the page with Universal analytics, you can actually tell what must be the value that will be recorded. you can decode your path using JS and pass it like below:
ga('send', 'pageview', { 'page': '/YOUR-CUSTOM-PATH' });
Using GTM:
Changing the "dp" value can be accomplished in GTM by setting the desired value in the page field, under "Fields to set":
Let me know if you have doubts.

Related

Google Analytics Custom Dimensions Not Tracking

I want to split test different layouts on my site, and to track this I want to use a Custom Dimension which is named Split and equal to 1 or 2.
I've configured the Custom Dimension in Google Analytics and added the code like this:
// Google Analytics
gtag('config', 'UA-70465331-1'), {
'custom_map': {'dimension3': 'Split'}
});
// Sends the custom dimension to Google Analytics.
gtag('event', 'SplitTest', {'Split': "2"});
However, when using the Google Tag Assistant, the Custom Dimension isn't appearing under Events.
The live page is: https://www.travelden.co.uk/mindblowing-new-hotels-in-the-maldives
Can anyone see where the error is?
Much appreciated!
It is coming through:
You need to be careful to set the event to "non-interaction",
I would also suggest you to not send an event if you don't need it...so something like this:
gtag('config', ''UA-70465331-1', { 'dimension3': '2' });
Doing it this way the dimension is applied when the page is loaded, which is really what you're testing, the layout.

How to use Google Analytic custom dimension?

I have read some google analytic custom dimension explanations but still can't find a tutorial that explains the steps from beginning to end. I know many have discussed this but many tutorials are incomplete and jumping from the side of the settings in Google Analytics and from the side of laying the code in the project makes me confused.
What I have done,
First I add custom dimension from admin->custom definition->custom dimension
Then, I create a custom report from customization for showing my custom dimension
Then, I put the javascript code in my project
<script>
var test = 'test';
ga('create', 'UA-11xxxxxx', 'auto')
ga('set', 'dimension1', test);
ga('send', 'pageview');
</script>
But, If open the custom report it always returning no data(I have waiting more than a day but still no data)
Is there something wrong with what I've done or are there any steps that were missed?
Any helps will be appreciated. Thanks.

How to track Outbound links without breaking links to affiliate templates with no GA code

I have hundreds of affiliate templates and when I change the GA file, it applies to all the templates.
If I want to track outbound links, I have no choice but to put the GA javascript code in all my templates, as well as the outbound links.
Javascript is this:
<script>
var trackOutboundLink = function(url) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){document.location = url;}
});
}
</script>
My understanding is that the outbound link (like below) will break if the GA tracking code is not included on a template (i.e. UA-#######-#) :
Track this link
Some of the affiliates do not have or want their GA code (i.e. UA-#######-#) included in the template.
Is there a way to set up outbound tracking without breaking the links on templates without GA code?
Thank you.
Yes, you can create a Measurement Protocol hit to send the data without using GA code.
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers
The hit looks something like this
www.google-analytics.com/collect?v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fhome
Where tid =Tracking ID / Property ID.
Learn more about the measurement protocol here: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide

Use of Tealium to track multiple on-page tags for each Google Analytics Content Grouping

I'm in the middle of researching this and can't find a ton on the exact subject, so I was hoping one of you fine people might have the answer. Essentially, I'm trying to set up Content Groupings in Google Analytics for a network of WordPress installations where each blog post can have n number of tags and categories.
The Content Grouping would be something like Home Page, Posts, Pages.
Under the "Posts" Content Grouping, let's say I have a Movie post type that can track different genres (Romance and Comedy, or Science Fiction and Horror, or Action, Science Fiction and Horror, or even just Romance at times). I'd want to inject those into the page (easy enough to do), then loop through them and set them under the Posts content grouping for that particular page load.
However, the client is using Tealium for Google Analytics tracking, which adds a layer of abstraction to things. So the question is really a two-parter:
How would I fire off multiple tags for a given Content Grouping on a given page load so they're useful within Google Analytics?
How would I use Tealium to do that?
Tealium does offer up some documentation on Converting GUA Tracking to Tealium Tracking, like so:
Example GUA code snippet for event tracking
ga('send', {
hitType : 'event',
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
});
Converting to Tealium style by setting the ga_events variable with the GUA event fields:
utag.link({
ga_events: [{
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
}]
});
This is exactly the kind of Conversion Documentation I am looking for. However, it does not cover my use-case, which seems to require multiple calls to something like:
ga('set', 'Posts', 'Action');
ga('set', 'Posts', 'Science Fiction');
ga('set', 'Posts', 'Horror');
How would I do this (successfully) using Tealium?
Thanks in advance for any feedback or help anyone is willing to offer!
Edit
https://megalytic.com/blog/adding-google-analytics-content-group-tracking-to-a-wordpress-theme-using-google-tag-manager
This link talks about what I'm attempting to do, but using Google Tag Manager as opposed to Tealium. There is a lot of overlap there, so I'll try to dive in and find the equivalent process, but I'd still appreciate any help someone can provide!
It sounds like you'd be best off just writing your own custom javascript to manually fire your google analytics events. Could you use a custom container as described here? You can remove the script src if you don't need to load anything. You should then be able to have that container run on every page load.
Tealium works by mapping the variables in each tag.
First of all you need mapping the content grouping in your Google Analytics tag.
Then you can add the variable into the utag.link:
utag.link({
ga_events: [{
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
}],
Post : 'Action'
});

How to send traidtional GA event in GTM's custom HTML tag

I'm using GTM in my company's online shop, and I installed some other tag via GTM's custom HTML tag, like this:
<script>
//some JS code...
var customParam=[{"key":"value"}];
var jsElm=document.createElement("script");
jsElm.type="text/javascript";
jsElm.async=true;
jsElm.src="https://some_tags.com/tag.js?s=CV";
document.body.appendChild(jsElm);
if(today < some date)
{
SEND GA EVENT here.....
}
</script>
The traditional GA event script
ga('send', 'event', 'XXX', 'pageview', 'some description', 1);
isn't working anymore here.
How do I did this ?
And I heard someone said that I should put data into DataLayer and do some bla bla bla... but I was understanding that too few to try. Is that a right way ?
I am going to answer with another question. Why are you sending events through HTML tags instead of Google Analytics Tag that are build just for that purpose?
I ll work with the assumption that you are new with this tool but the idea is that GTM replaces all old GA code on site.
Just create a new Tag and select 'Universal Analytics' and after that you can choose which kind of information you want on Google Analytics.
Its pretty self explanatory as a tool so i strongly recommend you to forget about those old GA codes and work with what you got.
In addition to this have in mind that you can use custom javascript variables to scrap DOM values in case you need to.
Here is our guru Simo Ahava: https://www.simoahava.com/
If you need anything else just ask.

Resources