How to track clicks on Links using GTM - html

I have an ads campaign and I don't know from where users came to my website and
How can I know which one of those links users click must
www.example.com/twitter
www.example.com/whatsapp
www.example.com/linkdIn
www.example.com/<this will be the source name>
I want to know which link users came from using GTM.
All links must open on the landing page.
Thanks.

You don't really need GTM to track click source. The GA script translates certain query parameters to traffic source dimensions automatically. Those query parameters are called UTM parameters. Here's the documentation on how they're mapped to GA data.
You can use the url builder tool to generate a url if you find it difficult to figure out the proper syntax.
Basically, you just generate a link to your landing, embedding there the information about the source and then you post the link on the said source. And you carefully do that for all sources.
Sure, GA also tracks the referrer, but TLS will eraze the query params of the referrer, so it may be much more awkward to use to determine the source, but GA already tries to parse the referrers to determine the source automatically, when no utm params are set. UTMs will override the automatic referrer logic.
Finally, GTM. GTM is powerful. It allows you to do more than that. For example, it's able to override the above described logic and set the source, medium, keyword, even referrer, using JS. Ultimately, mostly because of GTM's ability to deploy custom JS, it is possible to override any field in tracking and add extra fields.

Related

Flutter - get coarse location to improve search results - without explicit permissions

So I've been developing a Flutter app, and I have a form that enables the user to choose a location from a SearchBox. This SearchBox is provided by this package https://github.com/Bernardi23/search_map_place.
It makes use of Google Maps API to provide results. It allows a location parameter to refine these results.
However, I don't want to ask the user explicitly for his location, as I don't need an exact location, but a very coarse one, simply to refine the results (if the user is from the US I don't want to show him results from Europe).
Is there a way to do this without asking explicitly for location permissions?
I would use a package like flutter_ip and pass the result of any external IP address found to an API like https://ip-api.com.
BUT it might be against the acceptable use policies of both PlayStore and AppStore, if you feel you can risk it, go ahead (This is a feeling I have, it might be totally ok)

Pass Mediawiki "wgUserName" to Google Tag Manager

I have an install of Mediawiki for my company which I have tracking page activity currently, but I also want to be able to track page activity per user.
Ideally, I'd like to pass the wgUserName into Google Tag Manager as the userid that Google Analytics sees.
How can I pass the wgUserName into the data layer from the wiki? I just need to get that into Tag Manager.
Thanks!
I don't think you'll need the data layer for this, according to https://www.mediawiki.org/wiki/Manual:Interface/JavaScript
You can access the config via: mw.config and the value for "wgUserName" can be found with "mw.config.get("wgUserName")"
Thus all you need to do in GTM is create a Custom JavaScript variable and reference it:

Analytics Filter to attribute a specific landing page to a certain referrer?

our business advertises on the classifieds website www.kijiji.ca, and as part of that they have a link back to our website on all of our advertisements. In what looks to be an effort to prevent tab-nabbing, kijiji recently added rel="nofollow noopener noreferrer" to their 'referral' links. This had the unfortunate side-effect of breaking analytics for me, and any other person who advertises on kijiji.
I've taken this up with Kijiji, but as I suspect it's a security concern on their part I doubt they'll be open to changing it. They are currently investigating the issue.
At the same time as the original change, they forced '/referral=kijiji' to the end of any URL passed into their website link field. So, my question is if anyone knows of a way to configure a filter in analytics which sees that url and causes the hit to be attributed as a referral.
Of course, as a work around you can just go into the Landing Pages report and search for '/refferal=kijiji', but that breaks reporting and causes your Mediums/Sources reporting to falsely attribute referrals as direct traffic.
If anyone has a workaround I'd be very grateful! Thanks for reading.
As far as I'm aware, there isn't a way to set a referrer after the data has been collected by GA as raw GA data is not modifiable. You could send a virtual pageview with a utm parameter for attribution purposes. Keep in mind that this will inflate your pageviews count and will also consider the session to be a non-bounce.
If it were me, I'd fire an event when I detected '/referral=kijiji' in the URL and then create a segment of sessions that included the event. Be sure to use a non-interaction event so that your bounce rate isn't affected.

Security of GAS for G-sites?

I want to create a script that runs on a Google site. The script would perform a specialized calculation for a given user and then display the answer for the user. The script would depend upon user input, but the code itself should not be viewable by the user. I want the code to exist in a "black box" so that the calculation formula can be kept secret. Is this possible?
I searched the documentation, but only found this, which does not address this question:
https://developers.google.com/apps-script/guides/services/authorization#permissions_and_types_of_scripts
Whether your App script is embedded in a site or written as a standalone script does not change a lot of things... the only difference will be the way you include it on a page as a gadget.
If it is embedded it will be available from a list of scripts in the page editing, if not you'll have to use the .exec url of the deployed webapp.
Anyway, that does not change the way people will have access to the app.
You can define these parameter when you deploy the app (which is mandatory in both cases), allowing for anonymous access or requiring to be logged in.
If I understood you correctly, you would like to restrict the access to some people but not share the code.
Depending on how you defined the access mode above and wether you are using a Google Apps inside a domain or not, you will be able to do it using 2 ways :
in a domain you can get the logged user identity and use that to accept/deny showing the app.
in a "normal" gmail account you will have to implement some sort of logging feature to request a user name and password to give access to the active part of the app.
In both case you never need to share the script itself, this sharing parameter is independent from the webapp access.
I hope I understood your question correctly... if not, feel free to comment.
You might check out the Private Functions section of the following page.....the example is similar to what you're referring to, I think.
https://developers.google.com/apps-script/guides/html/communication?hl=ru
I don't fully understand how they work and haven't used them myself, but I bookmarked it to figure out later. Maybe another user who understands Private Functions better can explain...

How to prevent crawlers from following links?

I'm building a site that will allow sellers to:
list their products on my site
have each product link back to the seller's site
be charged for each link clicked
What I need to do now is to somehow make sure that I am only logging actual human users following the links to the sellers site. If it's a bot crawling the site, I shouldn't be charging the sellers for that.
Is there a way for me tell bots not to follow a certain link? I don't think it's nofollow as that is not intended to block access to content.
The way to tell a bot not to follow a link is precisely to add rel=nofollow to your <a> tag.
Assuming you are also logging locally before forwarding to the external url you could also check the user agent string.
In fact, if you are going to ask people to pay based on number of referrals it might be an idea to log IP address and user agent against each paid for click in case your stats are ever questioned.
You just add a [robots.txt] file, e.g. like this one.
You can find more info about [robots.txt] files on the net, e.g. in Wikipedia.
Typicall you can identify them by the user agent string. You can find a list here, can't say it's perferct, but it's a good base to extend: PHP/MySQL - an array filter for bots
Robots.txt is another way, more about it here