Google Analytics, AdWords, & other tracking code

How to enable tracking for Google Analytics with E-junkie

If you are using E-junkie Buy Now buttons:

If you are only using E-junkie Buy Now buttons, rather than our Add to Cart/View Cart buttons, then you would need to follow Google's own instructions for "third party eCommerce" and paste their Analytics tracking code into your site's pages and into your thank-you page. In this case, E-junkie would be completely uninvolved in your Google Analytics tracking, so you would need to consult Google Analytics support for any assistance you may require.

If you are using E-junkie Add to Cart/View Cart buttons:

NEW!Our new shopping cart and new thank-you pages when used together now support Google Analytics and Facebook pixel tracking automatically, including support for Google's current Universal Analytics (analytics.js) and Global Site Tag (gtag.js) tracking code. Better yet, you won't need to use any custom tracking code from us. As long as your sales pages have the standard tracking code you obtain from Google or Facebook, and your E-junkie account is opted-in for our new cart and thank-you pages, and you're using our standard cart button codes with at least one copy of View Cart code on every sales page, our new thank-you pages will automatically insert the proper GA/FB tracking code (including Ecommerce Tracking details for GA) whenever it detects the buyer's browser has a tracking cookie set by that code.

If you are not yet using our new cart, E-junkie's classic cart is pre-integrated with Google Analytics if you use our version of Google's Analytics tracking code (given below); we can add cart-button click tracking to the regular Analytics page-traffic monitoring, and we also take care of context transfer and ensure that we don't report duplicate conversions if the buyer returns to their thank-you page again.

This will only work with the standard implementation of our cart, where the cart displays as an overlay "inside" your page. Just make sure you have at least one block of your View Cart code on every page that has any number of Add to Cart buttons, as the View Cart code manages the overlay-style cart which is required to use our version of the Google Analytics tracking code.

Then, just place the following tracking code in every page of your site where you are using E-junkie cart buttons, and also in any other pages in your site where you wish to use Analytics tracking as well. You can paste this at the bottom of every page just before your </body> tag for optimal page-load performance, or you can place it between your page's <head> and </head> tags if you want to be sure it loads before anything else in the page for more consistent tracking. When you paste the tracking code, replace UA-XXXXXX-X with the ID provided to you in your code from Google Analytics.

This is our current Google Analytics tracking code (to track cart-button activity, use this version rather than the generic tracking code Google provides):

<script type="text/javascript">
var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");
document.write(unescape("%3Cscript src='"+gaJsHost+
  "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var ejGATracker = _gat._getTracker("UA-XXXXX-X");

Do not add any Analytics tracking code into your E-junkie Thank-you Page customization fields if you are using E-junkie Add to Cart/View Cart buttons and our version of the GA tracking code, as that would conflict with the integrated GA tracking data we already provide there automatically. However, if you are redirecting buyers to a Common Thank-you Page URL or using product-based Redirection URLs, then you should place our version of the Google Analytics code (as provided above) in your site's Thank-you/Redirection Page(s) as well.

Ecommerce Tracking for Google Analytics

Make sure you select Ecommerce tracking: Yes, an Ecommerce Site in the Profile Settings for your site in Google Analytics, and add our version of the GA tracking code to your pages as explained above. Whenever the thank-you pages we generate for you detect the buyer's browser has a tracking cookie set by our version of the GA tracking code, the page will include Ecommerce Tracking data for GA to pick up; however, the consistency of this still depends on whether or not buyers actually view their thank-you page at some point after completing checkout.

Goals-based Conversion Tracking

If you are setting Goals in your Analytics account, you will need to specify your Goal URL as (or if you are redirecting to a Common Thank-you Page URL on your site, you should use your page URL here), and under additional settings, set Match Type as Begins With (aka Head Match). See this FAQ page to see if your use of E-junkie will be able to track Goals consistently. This provides a sort of rudimentary "conversion tracking" if you aren't using Ecommerce Tracking with our version of the GA tracking code (see above) and count every Goal tracked as a sales conversion.

How to trigger a conversion tracking pixel or Web beacon

Third-party tracking services (e.g., Google AdWords or independent affiliate systems) may track conversions by providing a snippet of tracking code that they require you to place on your post-checkout thank-you page. That method should work fine if you are selling downloads and using your standard E-junkie-generated thank-you/download pages, so you can just paste your conversion tracking code in Seller Admin > Manage Seller Account > Edit Preferences > Common Thank-you Page HTML (to have the same code added to every thank-you page we generate for you), or in the Product Thank-you Page HTML field of each product's settings (to have the code only added to thank-you pages when that particular item is purchased).

However, if you are redirecting to a thank-you page on your site or not selling downloads the way our system works may interfere with that method of conversion tracking, so our standard E-junkie Cart can now trigger a conversion-tracking URL (aka "tracking pixel" or "Web beacon" URL) without requiring you to add any tracking code to your thank-you pages. Simply add these lines to your View Cart code on every page, just after the line function EJEJC_lc(th) { return false; } in the standard View Cart code you obtain from Seller Admin:

function EJEJC_config() {
EJEJC_BEACON = "http://Put.Tracking.Pixel.or.Beacon.URL.Here";

For instance, your standard AdWords conversion tracking code would have a Web beacon tag like this:

<img height=1 width=1 border=0 src=""> in that example, this would be the AdWords Tracking Beacon URL:

Which would look like this in our cart customization code:

function EJEJC_config() {

Note that any & symbols in that URL must remain as a plain &, not converted to &amp; nor &#38;. If you are also using other cart customization code, just add the new EJEJC_BEACON line in place among the existing lines within your current function EJEJC_config(){} section.

How to enable conversion tracking for other programs that don't use a tracking pixel or Web beacon URL?

All these services will provide you with a custom code snippet that they require you to place on your "thank you" page. If they provide a "secure" version of their code, you should use that. The best place to paste this code is in your Seller Admin > Account Preferences > Common Thank-you Page HTML. If the code is product-specific, you can paste that in the Product Thank-you Page HTML field of that product's settings. If the code requires you to use some transaction or product specific data, you may be able to use template variables.

See the FAQ and Tips links in the upper right side of this page for further details about factors that can interfere with tracking conversions via thank-you page visits when you use E-junkie, and some suggestions to make this process more reliable if you don't sell downloads and/or are required to have the conversion page on your own site (rather than on a third-party site like the thank-you pages E-junkie would normally generate for you).