Analytics by Emerge2
Documentation
Enhanced usage tracking for websites using Google Analytics 4 and/or a Facebook Pixel.
Embed a short script into your website and enter your Google Analytics 4 and/or Facebook Pixel ID(s), and the tracking begins.
For advanced users, add any combination of the many optional parameters to customize how the tracking is performed.
Only track real invocations from the public.
The system will automatically SKIP logging in the following situations:
- invoked from an admin session or preview page
- invoked from a known bot
- invoked from a blocked IP address range (if you specify an IP address range to ignore, e.g. your office so that staff activity doesn't skew your usage stats)
- invoked with a URL that contains the optional variable ?e2monitor=x or &e2monitor=x (you can optionally use one of these URL variables in a site uptime/downtime monitoring tool, or when using website validation tool(s), or any other services to avoid tracking these recurring invocations of your website by your infrastructure or other services so your stats don't become skewed by overhead activities)
Fragmented "Referrer URLs" are combined so that your Page View stats are not eroded through the use of many subdomains used by online systems, e.g. usage from l.facebook.com, lm.facebook.com, m.facebook.com, apps.facebook.com, etc., are all recorded with a normalized source or referrer URL of facebook.com. The same for other known fragmented referrer URL sources from popular online platforms. This default defragmentation can be disabled.
Example for Google Analytics 4 tracking
<script type="text/javascript">
var e2_analytics_ga4_id = 'G-xxxxxxxx';
var e2_analytics_is_misc = true;
</script>
<script src="https://common.emerge2.com/emerge2_analytics_v3.js" async type="text/javascript"></script>
Example for both Google Analytics 4 and Meta/Facebook Pixel tracking
<script type="text/javascript">
var e2_analytics_ga4_id = 'G-xxxxxxxx';
var e2_analytics_fb_pixel_id = 'nnnnnnnnnnnnnn';
var e2_analytics_is_misc = true;
</script>
<script src="https://common.emerge2.com/emerge2_analytics_v3.js" async type="text/javascript"></script>
Many optional parameters can also be passed (see below), but the above two scenarios are very common.
e2_analytics_is_{TYPE} Parameter
One (and only one) of the following "e2_analytics_is_{TYPE}" parameters should be included to tell the logic what type of website it is:
var e2_analytics_is_builder = true; // a Builder.io site
var e2_analytics_is_gc = true; // a Galileo Commerce site
var e2_analytics_is_volusion = true; // a Volusion site
var e2_analytics_is_wordpress = true; // a WordPress site
var e2_analytics_is_misc = true; // for all other site types
The site type is used by a variety of subsections to determine, for example, when a user is within an admin session, how to parse ecommerce data for conversion tracking, how to determine which unneeded URL query parameters should be removed, etc.
Passable Parameters
Each of the following parameters can be specified in a Javascript "var" statement with its associated value enclosed in single or double quotes (except for the true/false values which should not be enclosed within quotes). Each such statement should end with a ";" and must be specified before invoking the "emerge2_analytics_v3.js" script. For example:
<script type="text/javascript">
var e2_analytics_ga4_id = 'G-xxxxxxxx';
var e2_analytics_is_wordpress = true;
var e2_analytics_bypass_ip_addresses = "64.209.168.0/24";
var e2_analytics_currency_code = "USD";
</script>
<script src="https://common.emerge2.com/emerge2_analytics_v3.js" async type="text/javascript"></script>
Input Variables | Values | Purpose | |
---|---|---|---|
e2_analytics_ga4_id | G-xxxxxxxx | The Google Analytics 4 (GA4) property ID for your site (sometimes called the "Measurement ID" from your Data Stream). | |
e2_analytics_ga4_id_2 | G-xxxxxxxx | To also record your usage to a second GA4 ID. This is sometimes used to aggregate the usage from a group of related sites into one Show More | |
e2_analytics_ga4_id_3 | G-xxxxxxxx | To also record your usage to a third GA4 ID. | |
e2_analytics_ga4_id_4 | G-xxxxxxxx | To also record your usage to a fourth GA4 ID. | |
e2_analytics_fb_pixel_id | nnnnnnnnnnnn | To record your usage to a Meta/Facebook Pixel ID. | |
e2_analytics_currency_code | Currency Code | The default currency of the amounts passed for order total, shipping, tax, product prices, etc. Possible values include USD, CAD, Show More | |
e2_analytics_bypass_ip_addresses | n.n.n.n n.n.n.n-n.n.n.n n.n.n.n/nn |
Do not track any invocations from a user IP address that matches any of the IP addresses or address ranges defined by this variable. For example, if the value is "64.209.168.100" then ignore Show More | |
e2_analytics_diagnostics | true or false Default: false |
Display diagnostic or interim progress messages on the browser's Inspect Console during script processing while experimenting with options. | |
e2_analytics_display_contact_info | true or false Default: false |
Display instructions on the browser's Inspect Console regarding how to email or submit a support ticket to Emerge2. | |
e2_analytics_display_removable_query_vars | true or false Default: false |
Display on the browser's Inspect Console the list of known unnecessary URL query parameters which will be removed Show More | |
e2_analytics_defrag_query_vars | true or false Default: true |
If false, then disable the normal removal of known unnecessary URL query parameters before recording the URL invocation. Show More | |
e2_analytics_defrag_referrer | true or false Default: true |
If false, then disable the normal defragmentation of the "Referrer URL" from popular online platforms, resulting in fragmented Show More | |
e2_analytics_is_builder | true or false Default: false |
This is being invoked from a Builder.io or Impact eCommerce site. | |
e2_analytics_is_gc | true or false Default: false |
This is being invoked from a Galileo Commerce (GC) site. | |
e2_analytics_is_volusion | true or false Default: false |
This is being invoked from a Volusion site. | |
e2_analytics_is_wordpress | true or false Default: false |
This is being invoked from a WordPress site. | |
e2_analytics_is_misc | true or false Default: false |
This is being invoked from another type of site (not Builder.io, GC, Volusion, or WordPress). This is automatically enabled if no other e2_analytics_is_* variable is set to true. |
Technical Questions
If you have any questions regarding this utility, please contact e2eae211Gk337UlMa39Mw5A0pip5qpNSowi|.