Google Analytics Email Pixel Generator | AdsUpNow
 

Google Analytics Email Pixel Generator

April 14, 2017

Shameless self promotion: Interested in getting better results from your email campaigns? Click here to see how we can help!

Google Analytics Pixel Generator

Useful for emails, embedding in pages, etc.

Basic Info:

This is a tool for building Google Analytics image pixels (HTML IMG tags) that you can embed into emails to track opens, or embed into webpages, into ads, etc.

If you want to, you can simply enter your Analytics ID and the subject line of your email, and that is enough to generate a GA pixel! However, if you want to customize further, you can also edit the event action, category, and URL.

You can also use the "Fire Event" button to send an actual event hit to Google Analytics, which you can verify by looking at your real time event section.

Want more documentation and behind the scenes nitty gritty on how this GA Pixel Generator works? Click here!

Advanced Info:

/*
  Manual (Async) Event Tracking with Google Analytics
  ====================================
  Original Credit: http://labnol.org/?p=8082
  Found on: https://ctrlq.org/code/19728-google-analytics-without-javascript
  Modified heavily by Joshua Tzucker (adapted for general use, turned into a form version, and added IMG insertion)
*/

// Work in Progress - Need to fix page title, remove unnecessary parameters

/* References
--- GOOGLE RECOMMENDATIONS FOR EMAIL: https://developers.google.com/analytics/devguides/collection/protocol/v1/email
-- Google Hit Builder Tool and Tester: https://ga-dev-tools.appspot.com/hit-builder/
Measurement Protocol (analytics.js new): https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
UTM GIF (ga.js legacy): https://developers.google.com/analytics/resources/concepts/gaConceptsTrackingOverview#gifParameters
	https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTroubleshooting#gifParameters
UAID off Google's Analytics section: UA-24532603-1
*/

/* Parameters Cheatsheet - (analytics.js)
	ec = Specifies the event category, required for event hits (e.g. "Category")
	tid = Account string (UA-ID) (e.g. "UA-24532603-1")
	z = Used to send a random number in GET requests to ensure browsers and proxies don't cache hits. (e.g. "289372387623")
	cid = This field is required if User ID (uid) is not specified in the request. This anonymously identifies a particular user, device, or browser instance. (e.g. "35009a79-1a05-49d7-b876-2b884d0f825b")
	ea = Specifies the event action, required for event hits. (e.g. "Action")
	dt = Page title (optional?)
	dp = document path
	dl = document location
	t = hit type. Must be one of 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'. 
*/

/* Parameters Cheatsheet - ga.js legacy GIF 
	utmac = Account string (UA-ID) (e.g. "UA-24532603-1")
	utmn = Unique ID generated for each GIF request to prevent caching of the GIF image.
	utmp = Page request of the current page. (aka pathname)(e.g. "/testDirectory/myPage.html")
	utmdt = Page (document) title, which is a URL-encoded string. (e.g. "analytics%20page%20test")
	utme = Extensible Parameter. Format is "5(object*action*label)(value)", where
		- 5 is a constant
		- Object and action are required
		- label and value are options
	utmr = Referral URL (e.g. "http://www.example.com/aboutUs/index.php?var=selected")(def: 0)
	utmwv = Tracking code version (e.g. "1")(def: 5.4.5)
	utmhn = Host Name, which is a URL-encoded string (e.g. "x343.gmodules.com") (not to be confused with full page path)
	utmt = Type of request (accept: "event", "transaction", "item", "page", custom variable)(if not defined, defaults to page hit)
	utmcc = Cookie values. This request parameter sends all the cookies requested from the page. 
		Fake: __utma%3D999.999.999.999.999.1%3B
		Google Example: utmcc=__utma%3D117243.1695285.22%3B%2B __utmz%3D117945243.1202416366.21.10. utmcsr%3Db%7C utmccn%3D(referral)%7C utmcmd%3Dreferral%7C utmcct%3D%252Fissue%3B%2B
*/

/* Cheatsheet for my generator
	accountUAID = self explanatory, your GA analytics ID that the hit should be sent to. If you want to sent to multiple accounts, just create one pixel per account
	event_action = should be descriptive, Google recommends "open"
	event_category = Google recommends "email"
	url = unless you want to spoof a visit to an actual webpage, this should be fake and the only section used should be the pathname, which Google recommends you have as /email + something unique (e.g. subject line)
	version = universal vs legacy. Just pass null now since function returns both
	page_title = subject line of email
*/
        
Don't know what this is? Click here!
  1. Sign in to your Analytics account.
  2. Click Admin.
  3. Select an account from the menu in the ACCOUNT column.
  4. Select a property from the menu in the PROPERTY column.
  5. Under PROPERTY, click Tracking Info > Tracking Code.
If this is going in an email, just leave this as the generated default (Google recommends /email/ + unique string).
Looking for just the hit URL? Click here.

This will send an actual event fire to your GA account. You can use this to test by looking at the "Real Time" section in Google Analytics and watching for the event fire to show after clicking the button!

Leave a Reply

Your email address will not be published. Required fields are marked *

More Services