Tracking Email Opens with GTM Event - google-analytics

I'd like to trigger an event to identify when an image has been served upon visiting a site.
The goal is to use this event for email open tracking. I already have a tracking pixel embedded in the email that served from my website each time the user opens the email.
I have the event set up to store the 'Label' = a variable that contains the query string from the URL referre. This should in theory capture the utm parameters from the URL, for example:
website.com/1x1tracker.gif?utm_source=email&utm_campaign=emailcampaign1&utm_content=welcomeemail
Where I am getting stuck is the trigger for the event. For a normal image viewing event I could just do something with an 'Element Visible' trigger and be done with it, but since the image is requested from the website via the email client, no one actually visits the site.
Curious to hear thoughts on how I can get this event to be triggered by someone opening the email and having the request for the image sent to my site.
Thank you!

You won't be able to track email opens with GTM since it only works in a DOM environment and requires some Javascript to run on the page.
However, you can send events to Google Analytics through Measurement Protocol based on the parameters in your pixel URL. Google provides a sample code to do that on the help pages.

Related

how can I validate if good analytics is counting review with ajax request

I have installed the google analytics in our e-commerce site using google tag manager. From the product detail page you can click on the colors to see the same product in the different colors. I implemented this using ajax so the page load is not required. I was curious if the google analytics will count as multiple reviews a user clicks on the different colors or do I need to explicitly call something in order for the GA to count as multiple reviews.
First of all, that depends how and what kind of GA you've implemented.
To implement analytics, you have to specify a trigger for the analytics tag. That trigger normally determines if a tag is fired or not.
If you used a page load trigger, then the tag will only be triggered on the real page load. And it won't be triggered on your ajax manipulations.
With only one exception: if you used the GA4 config tag, you had this checkbox there:
The checkbox doesn't only send the pageview on config load, it keeps sending pageviews on every history change. Therefore, if your ajax causes history change and you use the GA4 config tag, then you're getting pageviews.
But this is theory. You can just go and check. Open your network tab, filter the request by collect and see what's sent when. Or alternatively, install the adswerve datalayer debugger and it will log whatever is sent whenever it's sent into the console in a very neat, clean way. This is how it works on this page:

How to disable certain fields in Firebase Analytics?

I use Firebase Analytics and the URL (aka page_referrer in analytics) might reveal which user is behind the event. Can I somehow disable certain fields in an event like page_referrer?
Check this example below. page_referrer is localhost because of my development environment. But I can see the full URL which could reveal from which user this event is.

How to connect Google Analytics Measurement Protocol (back end) with a front end session? Only via Client ID?

I have a website with Google Analytics tracking on and I have a goal that listens to the event EVENT1.
If I open a private tab and go to page P1, I can see it being registered as a landing page. All good.
And I visit a second page, P2, and then send the event EVENT1 (which is connected to a goal) I will see that the landing page now gets a goal conversion. All good.
This is the view I am talking about (please note that the data in the image does match my example!):
However, if I create a new GA session, and thereby get a new client ID (let's say the ID is CID123), visit page P1 then P2, but my backend sends the event instead over the Measurement Protocol to Google Analytics, where I specify cid=CID123, then the landing page conversion does not work.
I can see the event coming into Google Analytics, and I can see the goal is increased, but for some reason, the landing page conversion status does not work.
So my question is..
.. how do I connect a front end GA session with anything I send over the Measurement Protocol?
Since the landing page conversion does not get updated, it seems like I am missing information in my backend hits to allow Google Analytics understand its the same session.
Is specifying the client ID cid= the only thing required?
Or are there any other fields/properties/data that I need to attach to connect them two?

Google Analytics : How to track image/PDF URL is accessed?

I am sending an marketing Email attaching an image or PDF URL.
Is there is any way to track how may users viewed/clicked this page via google analytics ? I could see the number of page view who accessed html pages but seeking for a way to find how many of them accessed image or PDF URL?
Including a link directly to a pdf or image will simply open the resource without JavaScript tracking or cookies required for Google Analytics.
You would need to send a GA hit from your server in response to the request for those files - neither trivial nor recommended in this case
Rather send the link to a page on your site containing the content.
Tracking that in GA is trivial and is likely already set up on your site.
If you need to have the content in a PDF rather than on the web page directly, have a link to the PDF and track that as an event or Virtual Page View
I would also recommend tagging the link in your email with GA UTM Campaign Parameters to identify the traffic from that link
If your question is about tracking the email itself, please restate the question.

How to capture if a visitor is from a google adwords click

When a user signs up on my site I want to be able to store whether or not they came to my site via an Adwords campaign.
I know google uses javascript to track conversions based on a cookie that is created on the users machine. Is there a way I can check this cookie so I can store the source against the user account?
You're correct--you can read this data from the cookies.
To configure the tracking:
connect your adwords and GA
accounts:
in your AdWords account, go to My
Account > Account Preferences, click
the "edit" link next to Tracking
then select the box that says
"Destination URL Auto-tagging".
Click "Save Changes";
still from your AdWords account,
click the Analytics tab and choose
Analytics Settings > Profile
Settings > Edit Profile Information;
check "Apply Cost Data", then click
Save Changes
So how can you tell if it's working? And where does GA store the data?
Grab an initial __utm.gif request and look at the Referer. Appended to the URL is a new parameter "gclid." This is the keyword-specific parameter (unique to your account). It's this parameter that distinguishes your visitors as AdWord-originating (i.e., "google(cpc)") from "google(organic)" Here's one i just grabbed and anonymized (scrambled the numbers/letters):
Referer: http://www.adomainname.com/?gclid=CKr61p31yKACFZlg4wodjj3gbA
You'll see this identical string in two other places in the same tracking pixel request:
(i) as the value for the GIF Request Parameter "utmp" which is the page request for the current page, and, most importantly;
(ii) as the value for the GIF Requests Parameter "utmcc"--the container for the cookies. The specific cookie that holds the adwords data is __utmz, which is actually the container for all referral data. Here's an anonymized example i just grabbed more or less at random (i.e., i just did search in Google using a query comprised of obvious Adwords and then clicked one of the paid links in my search results, then just pulled the Request Header):
utmcc=__utma%3D755416178.1576730350.1269876846.1269143846.1269143846.1%3B%2B__utmz%3D219726107.1269143846.1.1.utmgclid%3CKr61p31yKACFZlg4wodjj3gbA%7Cutmccn%3D(not%2520set)%7Cutmcmd%3D(not%2520set)%7Cutmctr%3Dhomes%2520for%2520sale%3B
HTTP/1.1
You could add an additional url parameter to the url you gave at google adwords, and check for it on your site and store in a session variable or cookie.
At registration of a user account check for this session or cookie you have created and act accordingly..
I know this already has an accepted answer but it's very out of date. The updated way can be found here: https://support.google.com/analytics/answer/1033981?hl=en
C+P'd:
In order for Analytics to display details about your AdWords keywords
and costs, you must do one of the following:
Enable auto-tagging. This is the recommended approach and ensures that
you get the most detailed AdWords data. Manually tag all your keyword
final URLs with tracking variables. You should only do this in the
special cases outlined below.
How auto-tagging works Auto-tagging automatically imports AdWords data
into Analytics. Combining AdWords data with the rich post-click
information provided by Analytics allows you to see what happened on
your site after people clicked on your ads.
When you enable auto-tagging, a parameter called gclid is added to
your landing page URL when a user clicks over to your site from an ad.
For example, if your site is www.mysite.com, when a user clicks on
your ad it appears in the address bar as:
www.mysite.com/?gclid=123xyz
Enable auto-tagging To enable/disable auto-tagging:
Sign in to your AdWords account. Click the gear icon, and select
Account settings. Make sure you're on the Preferences tab, and click
Edit in the Tracking section. Select (enable) or clear (disable) the
Auto-tagging checkbox. Click Save changes.
You could always provide an adwords-specific landing page. That way you have a lot freedom to do whatever you want with the incoming adwords user...

Resources