-
Notifications
You must be signed in to change notification settings - Fork 0
1 General paramaters for the Javascript tracker
HOME > [SNOWPLOW TECHNICAL DOCUMENTATION](SnowPlow technical documentation) > Trackers > Javascript Tracker > General parameters
## 2. General parameters- 2.1 Setting the endpoint
- 2.1.1
setCollectorCf
- 2.1.2
setCollectorUrl
- 2.1.1
- 2.2 Setting the application ID
- 2.2.1
setAppId
- 2.2.1
- 2.3 Setting the user ID
- 2.3.1
setUserId
- 2.3.1
There are two "global parameters" that should be set for the Javascript tracker:
- The collector endpoint
- The application ID
These are generally set as part of the pageview tracking tags, before the actual trackPageView
method is called e.g.
<!-- SnowPlow starts plowing -->
<script type="text/javascript">
var _snaq = _snaq || [];
_snaq.push(['setCollectorCf', '{{CLOUDFRONT-DOMAIN}}']);
_snaq.push(['setAppId', '{{MY-SITE-ID}}']);
_snaq.push(['trackPageView']);
(function() {
var sp = document.createElement('script'); sp.type = 'text/javascript'; sp.async = true; sp.defer = true;
sp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://d1fc8wv8zag5ca.cloudfront.net/0.10.0/sp.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sp, s);
})();
</script>
<!-- SnowPlow stops plowing -->
Endpoint refers to the location of your collector: you need to point your Javascript tracker to your collector endpoint, to ensure that data generated by the tracker is logged by the collector.
If you are using a Cloudfront collector you can use setCollectorCf to set the endpoint. If you are using any other collector (e.g. the Clojure collector, or SnowCannon), then you should use setCollectorUrl.
#### 2.1.1 Setting a Cloudfront endpoint using `setCollectorCf`You can set the collector endpoint for the Cloudfront collector using:
_snaq.push(['setCollectorCf', '{{CLOUDFRONT-SUBDOMAIN}}']);
So if your domain is d3rkrsqld9gmqf
, you would include:
_snaq.push(['setCollectorCf', 'd3rkrsqld9gmqf']);
in your SnowPlow tag.
Back to top Back to Javascript technical documentation contents
#### 2.1.2 Setting a collector endpoint (e.g. for the Clojure collector) using `setCollector URL`If you are running a different collector (not the Cloudfront collector) then you set the collector endpoint using:
_snaq.push(['setCollectorUrl', '{{COLLECTOR-URL}}'])
E.g. if your collector endpoint is at 'my-company.c.snplow.com' then you would include:
_snaq.push(['setCollectorUrl', 'my-company.c.snplow.com'])
in your SnowPlow tags.
Back to top Back to Javascript technical documentation contents
### 2.2 Setting the application IDYou can set different application IDs on different parts of your site. You can then distinguish events that occur on different applications by grouping results based on application_id
.
To set the application ID, use the setAppId
method i.e.:
_snaq.push(['setAppId', 'my_application_id_here']);
Back to top Back to Javascript technical documentation contents
### 2.3 Setting the user IDThe Javascript tracker automatically sets a domain_userid
based on a first party cookie.
There are many situations, however, when you will want to identify a specific user using an ID generated by one of your business systems. To do this, you use the setUserId
method.
To set the user ID, use the setUserId
method i.e.:
_snaq.push(['setUserId', '[email protected]']);
Typically, companies employ this method at points in the customer journey when the user identifies him / herself e.g. if he / she logs in.
Note: this will only set the user ID on further events fired while the user is on this page; if you want events on another page to record this user ID too, you must call setUserId
on the other page as well.
Back to top Back to Javascript technical documentation contents
Home | About | Project | Setup Guide | Technical Docs | Copyright © 2012-2013 Snowplow Analytics Ltd
HOME > [TECHNICAL DOCUMENTATION](Snowplow technical documentation)
1. Trackers
Overview
Javascript Tracker
- Overview
- General parameters
- Specific event tracking parameters
- The relationship between Snowplow.js and Piwik.js
- Modifying Snowplow.js
2. Collectors
Overview
Cloudfront collector
Clojure collector (Elastic Beanstalk)
SnowCannon (node.js)
3. ETL
Overview
EmrEtlRunner
Hive ETL
Hadoop ETL
C. Canonical Snowplow event model
4. Storage
[Overview](storage documentation)
S3 / Hive
Amazon Redshift
Infobright
D. Snowplow storage formats (to write)
5. Analytics
Analytics documentation
Common
Artifact repositories