Step-by-step data collection guide
Introduction
Understanding the behavior of your web app visitors is crucial to create optimized content targeted towards them. Event data tells you about their behavior on your web app and it's easy to collect it with Prepr CMS.
With Prepr you can capture events, store and process the data to group these visitors into customer segments and personalize content for them.
Every event is associated with an event type, the time it happened, the customer that triggered the event, the related content item where applicable, and optionally some metadata. Events can be sent to Prepr using the Prepr Tracking Code or the REST API.
Event types
Event types are the types of interactions that a customer has with your content. For example, when a customer views an article. The following event types are predefined in Prepr CMS:
Event type | Event behavior |
---|---|
View | Automatically sent to Prepr when a page load is detected by the Prepr Tracking Code. |
Click | Used to track conversions in A/B testing and personalization components to calculate metrics. |
Like | Can only be recorded once per customer per content item. |
Bookmark | Can only be recorded once per customer per content item. |
Subscribe | Can only be recorded once per customer per content item. |
SignUp | Is the only event not linked to a specific content item. This event prevents the customer from being deleted after 90 days of inactivity. |
Unlike | When this event is sent to Prepr, the existing Like event will be deleted. |
Unbookmark | When this event is sent to Prepr, the existing Bookmark event will be deleted. |
Unsubscribe | When this event is sent to Prepr, the existing Subscribe event will be deleted. |
If the Like
, Bookmark
, or Subscribe
events are sent to Prepr more than once, the subsequent events will simply be ignored.
Apart from the predefined event types, you can collect event data for any Custom event.
For example, if you want to track when a visitor makes a Purchase
or clicks to Start
a video or livestream.
You can choose any name for the custom event that meets the naming rules below.
- Start the name with a capital letter.
- The name has to be one word. In other words, no spaces.
- Don't include any special characters like %, ˆ, &, etc.
- The name should not start with a number.
Record events using the Tracking Code
You can record events in Prepr CMS by using the Prepr tracking code. Once recorded, you can use these events to create the conditions you need to segment your customers. When you set up personalization, you can then include the segments that you want to target for each personalized variant.
Add the Tracking Code
Prepr uses a lightweight piece of JavaScript to capture events: the Prepr Tracking Code.
- Go to Settings → Tracking code.
- Click Copy code to get a ready-to-use Prepr tracking code and add it to the
<head>
section of your website.
Once you've added the tracking code to your front-end app, you can now track the events on your content items.
Track events on content items (Optional)
To start tracking events on content items, add the following meta property or name tag to the <head>
on all content pages.
This is an optional step because you can send events with the related Content Item ID in the send request.
If you don't include a Content Item ID in the send request, this tag is used to determine the Content Item ID.
Record View
events
When you add the prepr:id
property or name to your content page, a View
event will automatically be sent and recorded in Prepr when this content page loads.
<!-- property tag -->
<meta property="prepr:id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>
<!-- or name tag -->
<meta name="prepr:id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>
Replace the content
value in the property or name tags with your Content Item ID value.
To associate an event with an existing customer, an optional meta property or name tag can be added to the page. If your site uses an identity provider you can use that customer ID to track events on.
<!-- property tag -->
<meta property="prepr:customer-id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>
<!-- or name tag -->
<meta name="prepr:customer-id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>
If the Customer ID is not found in your customers list when the event gets processed, a new customer will be created. By default, a cookie with a unique ID will be used.
Once you set a Customer ID, this value will be used during the whole session (not only for this content item) until a new one is provided.
You can check that events are successfully being tracked in the Segments page in Prepr.
Send events to Prepr
Now that the customer events are being tracked on your content items (if applicable), you can send events to Prepr from your front end using the event method. You can include some optional metadata with the event.
In the example below we send a Like
event, for example when a customer clicks a Like link at the bottom of a published post:
prepr('event', 'Like');
If you have multiple content items on the same page, you can send the content item ID within the event.
prepr('event', 'Subscribe', { 'id': "16c63a1e-e837-4951-bd9a-b933a8d14b2f" });
If you need to tag a user when they fill specific values in a form on your page, for example, to segment customers based on an entered value, then you can send an event to set a Tag
on the user profile as follows:
prepr('event', 'Tag', ["healthcareworker"]);
To send a Custom event simply send the name of your custom event using the event
method.
In the example below we send a Purchase
event when a customer completes a purchase in the web app.
prepr('event', 'Purchase');
Exclude IP addresses from data collection
Enter the list of IP addresses that you want to exclude from data collection in your event tracking settings. For example, you can exclude interactions from yourself and your coworkers from being included in the metrics.
Record events using the REST API
With the REST API you can send event data to Prepr. This can be convenient for offline conversions or if you're working in a restricted environment and aren't allowed to load third-party Javascript snippets.
JSON Structure
The table below shows the fields that are supported in the REST API.
argument | type | required | description |
---|---|---|---|
label | String | Yes | Defines the event type. |
timestamp | UTC Timest. | Event timestamp (default time of request). | |
Content Item Data | |||
content_item | Array | Yes | |
content_item.id | String | Yes | Content item ID the event is recorded for. |
content_item.locale | String | Locale like en-GB . | |
Customer Data | |||
customer | Array | Yes | |
customer.id | String | ID of Prepr User | |
Metadata | |||
utm_medium | String | Campaign Medium | |
utm_source | String | Campaign Source | |
utm_campaign | String | Campaign Name | |
utm_term | String | Campaign Term | |
utm_content | String | Campaign Content | |
rl | String | Referrer location, example: https://prepr.io/ | |
sr | String | Screen resolution, example: 1680x1050 |
You need to supply a customer ID for the event to be recorded.
If the customer ID is not found in your customers list when the event gets processed, a new customer will be created.
Recording events
If you collected all the data, the JSON data object should be posted to the following endpoint:
POST https://tracking.prepr.io/events
{
"label" : "View",
"timestamp" : 1609588800, // Optional
"content_item" : {
"id" : "76a5e261-ec2a-4bd2-8195-cf7e889b0a68"
},
"customer" : {
"id" : "x-21381723243-PRP"
}
}
This endpoint requires an HTTP Authorization header with an Access Token containing the capture_publish
scope.
If the event was successfully queued the endpoint will return a status code 202 Accepted
.
The endpoint won't validate the input. Processing of the events are queued. Errors are logged in the access token request logs.
To validate your input, within a few seconds, you'll see the data reflected in the Prepr Segments page.
How search bots impact event data
What are bots?
A search bot, sometimes called a spider, is a robot that continuously browses the internet, usually for the purpose of building a search index or archiving websites.
Bots can either run on servers in a datacenter such as Amazon Web Services, or sometimes, on people’s personal computers that have been infected with malware or a virus (referred to as a botnet).
Some bots, such as GoogleBot, are used for legitimate purposes such as indexing the web.
Bots can artificially inflate event data, so it’s important to be aware of their existence.
Prepr and search bots
Prepr can detect search bots that deliberately reveal themselves. All traffic from known bots and spiders is automatically excluded. This ensures that your Prepr data, to the extent possible, does not include events from known bots. At this time, you cannot disable known bot data exclusion or see how much known bot data was excluded.
Known bot traffic is identified using a combination of our research and the International Spiders and Bots List.
List of excluded bots
Below is a list of search bots and their user-agents that Prepr identifies.
user Agent | Search Bot |
---|---|
200pleasebot | 200PleaseBot |
360spider | 360Spider |
abot | CrawlDaddy, abot |
addthis | AddThis |
adldxbot | Microsoft Bing Ads |
admantx | ADmantX Platform Semantic Analyzer |
adsbot-google | Google Adwords |
advbot | AdvBot |
ahrefsbot | Ahrefs backlinks research tool |
alexa | Alexa Crawler |
apache-httpclient | Java http library |
apachebench | ApacheBench (ab) |
apis-google | APIs-Google |
appengine-google | Google App Engine |
applebot | Apple Bot |
archive.org_bot | Internet Archive (archive.org) |
ask jeeves | Ask Jeeves |
asynchttpclient | Java http and WebSocket client library |
awe.sm | Awe.sm URL expander |
baidu | Baidu |
bdcbot | Big Data Corp |
bingbot | Microsoft Bing |
bingpreview | Microsoft Bing preview |
bitlybot | bit.ly bot |
blekkobot | Blekkobot |
blexbot | BLEXBot (webmeup) |
bot@linkfluence.net | Linkfluence bot |
bufferbot | BufferBot |
buibui-checkbot | buibui |
butterfly | Topsy Labs |
buzztalk | buzztalk |
catchbot | CatchBot (catchbot.com) |
check_http | Nagios monitor |
cliqzbot | Cliqzbot |
cmradar/0.1 | CMRadar/0.1 |
coldfusion | ColdFusion http library |
commoncrawl | CCBot |
comodo-webinspector-crawler | Comodo |
crowsnest | Crowsnest |
curabot | cura.yt |
curl | curl unix CLI http client |
dap/nethttp | DAP/NetHTTP |
datagnionbot | datagnion.com/bot.html |
daumoa | Korean portal and search engine indexing bot |
developers.google.com/+/web/snippet | Google Plus |
diffbot | Diffbot |
digitalpersona fingerprint software | HP Fingerprint scanner |
domain re-animator bot | Domain Re-Animator Bot |
domainsbot | DomainsBot |
domaintunocrawler | DomainTuno |
dotbot | Dot Bot |
duckduck | Duck Duck Go |
elb-healthchecker | AWS ELB HealthChecker |
embedly | Embedly |
eoaagent | EOAAgent |
eventmachine httpclient | Ruby http library |
everyonesocialbot | EveryoneSocial |
evrinid | Evri bot |
exabot | Exalead's bot |
exaleadcloudview | ExaleadCloudView |
facebookexternalhit | Facebook Bot |
facebot | Facebook Bot |
feedburner | RSS bot |
feedfetcher-google | Google Feedfetcher |
findxbot | Findxbot |
flipboardproxy | FlipboardProxy |
friendfeedbot | FriendFeed |
genieo | Genieo Web filter bot |
getprismatic.com | getprismatic.com |
gigabot | Gigabot spider |
gimme60bot | Gimme60 (gimme60.com) |
gimmeusabot | Gimme60 (gimme60.com) |
go http package | Go http library |
google page speed insights | Google Page Speed Insights |
google Web Preview | Google Instant Previews crawler |
google-structured-data-testing-tool | Google-StructuredDataTestingTool |
google-structureddatatestingtool | Google-StructuredDataTestingTool |
googlebot | Google Bot |
googlestackdrivermonitoring-uptimechecks | GoogleStackdriverMonitoring-UptimeChecks |
grapeshotcrawler | GrapeshotCrawler |
gravitybot | Gravity Bot |
hatena::bookmark | Hatena::Bookmark |
heritrix | heritrix |
htmlparser | HTMLParser |
http_request2 | HTTP_Request2 |
httpclient | HTTPClient |
https://developers.google.com/+/web/snippet (opens in a new tab) | Google+ Snippet Fetcher |
hubspot | HubSpot |
ia_archiver | Internet Archive (WayBackMachine) |
icoreservice | iCoreService |
idmarch | idmarch.org/bot.html |
inagist | URL resolver |
insieve | Insieve Bot |
insitesbot | Insitesbot |
instapaper | Instapaper |
istellabot | IstellaBot |
jack | jack |
jakarta commons | Jakarta Commons HttpClient |
java | Generic Java http library |
jetslide | Jetslide |
js-kit | URL resolver |
kemvibot | Kemvi |
kimengi | Kimengi Bot |
knows.is | knows.is |
kojitsubot | Kojitsubot |
komodiabot | KomodiaBot |
kraken | kraken |
laconica | Laconica |
libwww-perl | Perl client-server library |
lijit crawler | Lijit |
linkdexbot | Linkdex Bot |
linkedinbot | |
linkscrawler | LinksCrawler |
linode | Linode Longview |
lipperhey | Lipperhey |
livelapbot | Livelapbot |
loadtimebot | Load Time Bot |
longurl | URL expander service |
ltx71 | ltx71.com |
lumibot | Lumibot |
lwp-trivial | Another Perl library |
magpie-crawler | magpie-crawler |
mail.ru_bot | Mail.ru Bot |
meanpathbot | meanpath |
mediapartners-google | Google Adsense bot |
megaindex.ru | MegaIndex |
memorybot | mignify.com/bot.html |
metauri | MetaURI |
mfe_expand | Mcafee spider |
mir web crawler | MIR web crawler |
mj12bot | Majestic-12 spider |
mojeekbot | Mojeek UK search crawler |
mrchrome | MrChrome |
ms search 6.0 robot | MS Search 6.0 Robot |
msnbot-media | Microsoft media bot |
msnbot | Microsoft bot |
nerdybot | NerdyBot |
netcraft | Netcraft |
netstate | netEstate NE Crawler |
netvibes | Personalized dashboard bot |
netzcheckbot | netzcheck |
newrelicmonitor | NewRelic monitor |
newrelicpinger | NewRelicPinger |
newsme | newsme |
niki-bot | niki-bot |
ning | NING |
nutch | Apache search spider |
openhosebot | OpenHoseBot |
orangebot | OrangeBot |
pagesinventory | pagesinventory.com |
panopta | Monitoring service |
paperlibot | PaperLi |
peerindex | peerindex |
percolatecrawler | PercolateCrawler |
perfectmarketkwtbot | PerfectMarket |
phantomjs | PhantomJS |
pingdom | Pingdom monitoring |
plukkie | botje.com/plukkie.htm |
privacyawarebot | PrivacyAwareBot |
proximic | Proximic Spider |
psbot-page | Picsearch |
publiclibraryarchive.org | publiclibraryarchive.org |
pycurl | Python http library |
python-httplib2 | Python-httplib2 |
python-requests | Python http library |
python-urllib | Python http library |
queryseeker | QuerySeekerSpider |
quicklook | QuickLook |
re-animator | Domain Re-Animator Bot |
readability | Readability |
rebelmouse | RebelMouse |
redditbot | Reddit Bot |
relateiq | RelateIQ |
riddler | Riddler Bot |
rogerbot | SeoMoz spider |
rssmicro | RSS/Atom Feed Robot (rssmicro.com) |
ruby | Ruby |
scrapy | Scrapy |
screaming frog seo spider | Screaming Frog SEO Spider |
searchmetricsbot | SearchmetricsBot |
semrushbot | SEO analysis bot |
seokicks | SEOKicks |
seznambot | SeznamBot |
shopwiki | ShopWiki |
shortlinktranslate | Link shortener |
showyoubot | Showyou iOS app spider |
siege | Joe Dog Siege |
sistrix | SISTRIX |
siteuptime | Site monitoring services |
slack | Slackbot-LinkExpanding |
slackbot | Slack Bot |
slurp | Yahoo spider |
smtbot | SimilarTech |
socialrank | SocialRankIOBot |
sogou | Chinese search engine |
spbot | OpenLinkProfiler |
spider | generic web spider |
spinn3r | Spinn3r aggregator |
sputnikbot | SputnikBot |
squider | Squider |
statuscake | StatusCake |
stripe | Stripe |
test certificate info | C http library? |
tineye | TinEye Bot |
traackr | Traackr Bot |
trendictionbot | Trendiction Search |
turnitinbot | TurnitinBot |
tweetedtimes | The Tweeted Times |
tweetmemebot | TweetMeMe Crawler |
twikle | Social web search bot |
twitjobsearch | TwitJobSearch |
twitmunin | Twitmunin |
twitterbot | Twitter URL expander |
twurly | Twurly |
typhoeus | Typhoeus |
umbot | uberMetrics |
unwindfetch | Gnip |
uptimerobot | Uptime Robot |
vagabondo | Vagabondo |
vb project | Visual Basic |
vigil | Vigil |
vkshare | VKontake Sharer |
voilabot | VoilaBot |
vrcrawler | Venture Radar |
wasalive-bot | Wasalive Bots |
watchsumo | WatchSumo |
wbsearchbot | Ware Bay Best Buys |
webscout | Webscout |
wesee | WeSEE |
wget | wget unix CLI http client |
wordpress | WordPress spider |
wormly | WormlyBot |
wotbox | Wotbox |
xenu link sleuth | Xenu Link Sleuth |
xing-contenttabreceiver | Xing bot |
xovibot | XoviBot |
yacybot | YaCy |
yahoo-ad-monitoring | Yahoo Ad monitoring |
yandex | Yandex |
yeti | Naver Corp |
yourls | YOURLS |
zelist.ro | feed parser |
zibb | ZIBB spider |
zitebot | Zite |
zyborg | Zyborg |
Was this article helpful?
We’d love to learn from your feedback