Is there a way to track downloads from a static webpage? - google-analytics

All answers I found previously relied on tying the pdf download to an actual URL, but that isn't what I have.
I have a static website and on it is a button to click and download a pdf. Is there a way to track these clicks/downloads?

Either add google analytics script and add an event that fires on button click, or use Google Tag Manager and create a Click trigger to send an event.

Related

Google Optimize is implemented using GTM but is being triggered multiples times

We have an issue. GO is being fired every time I go to a new page. The website was built in SPA/react
Datalayer
They use a datalayer virtualpath that activates every time user go to a new page.
GTM
This DL was used as a custom event trigger to fire the Google analytics universal tag
Google optimize is associated to the Google analytics tag so every time a user to to a new page then go to a new page, the updatevirtualpath trigger is activated and the GO tag is fired.
Have anyone implemented Google optimize in GTM for react/ single page application websites where they use custom event as trigger ? When I use all pages trigger it works fine but when i use custom events it gets triggers every time user visit new pages..
Anyone know what can we do?

Is it possible to see what links are clicked on a particular page without using GTM

I have a page with a lot of links. I would like to determine if it is worth keeping all of them or removing those that users don't click on. So I would like to see what links are clicked on a page. Is this possible without Google Tag Manager?
You can set an event on click on each link with code in page, without GTM, so you can use i.e. a JavaScript function onclick.
See the documentation for event syntax (for gtag.js): https://developers.google.com/analytics/devguides/collection/gtagjs/events

track URL click on email with GTM

I was wondering how can we track a click on a link sent via email using Google Tag Manager.
I mean, the user gets an email that contains an URL to our website, we would like to know if the user clicks on that link.
Is it possible to do it all just using the GTM console or do we have to add some extra code to fire up the event?
To be pedantic, you cannot track the "click" on the link since the mail itself does not contain tracking code or GTM code.
However you can append a parameter to the link (if you are using Google Analytics you should tag all of your links with campaign parameters in any case). Then you can check within GTM (e.g. via a url type variable with component type set to query string) if the parameter is present and then fire your tags accordingly.

How to trigger an event tag when a user leaves a page?

In Google Tag Manager, I'm tracking the pageScrollDepth variable.
I want to trigger a Google Analytics event Tag that pushes (as custom metrics) the recent value of pageScrollDepth just before the user leaves the page.
How can I create the leavingPage trigger?
http://www.blastam.com/blog/index.php/2014/04/scroll-depth-tracking-analysis-google-analytics
^ The code in this blog post is the one that your are looking for where it takes the last scroll depth before the user leaves to another page. You will find a link to bitbucket to download the code
Paste the code in a Custom HTML tag and then create a JS variable to call the "callbackData.scrollPercent" for the Event Label

How to produce a URL for editing one of my existing Google Calendar events?

I am working on a Chrome extension for Google Calendar and I have access to all the JavaScript global variables defined by Google. The task is to send a user from some other page to their "edit event details" page in Google Calendar. Is there a URL for that? What tricks are known to work?
The Event object's htmlLink field has what you want.
https://developers.google.com/google-apps/calendar/v3/reference/events#htmlLink

Resources