Step-by-step guide

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 typeEvent behavior
ViewAutomatically sent to Prepr when a page load is detected by the Prepr Tracking Code.
ClickUsed to track conversions in A/B testing and personalization components to calculate metrics.
LikeCan only be recorded once per customer per content item.
BookmarkCan only be recorded once per customer per content item.
SubscribeCan only be recorded once per customer per content item.
SignUpIs the only event not linked to a specific content item. This event prevents the customer from being deleted after 90 days of inactivity.
UnlikeWhen this event is sent to Prepr, the existing Like event will be deleted.
UnbookmarkWhen this event is sent to Prepr, the existing Bookmark event will be deleted.
UnsubscribeWhen 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.

  1. Go to Settings → Tracking code.
  2. Click Copy code to get a ready-to-use Prepr tracking code and add it to the <head> section of your website.

tracking-code

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. content item ID

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.

custom event

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.

exclude IP addresses

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.

argumenttyperequireddescription
labelStringYesDefines the event type.
timestampUTC Timest.Event timestamp (default time of request).
Content Item Data
content_itemArrayYes
content_item.idStringYesContent item ID the event is recorded for.
content_item.localeStringLocale like en-GB.
Customer Data
customerArrayYes
customer.idStringID of Prepr User
Metadata
utm_mediumStringCampaign Medium
utm_sourceStringCampaign Source
utm_campaignStringCampaign Name
utm_termStringCampaign Term
utm_contentStringCampaign Content
rlStringReferrer location, example: https://prepr.io/
srStringScreen 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 AgentSearch Bot
200pleasebot200PleaseBot
360spider360Spider
abotCrawlDaddy, abot
addthisAddThis
adldxbotMicrosoft Bing Ads
admantxADmantX Platform Semantic Analyzer
adsbot-googleGoogle Adwords
advbotAdvBot
ahrefsbotAhrefs backlinks research tool
alexaAlexa Crawler
apache-httpclientJava http library
apachebenchApacheBench (ab)
apis-googleAPIs-Google
appengine-googleGoogle App Engine
applebotApple Bot
archive.org_botInternet Archive (archive.org)
ask jeevesAsk Jeeves
asynchttpclientJava http and WebSocket client library
awe.smAwe.sm URL expander
baiduBaidu
bdcbotBig Data Corp
bingbotMicrosoft Bing
bingpreviewMicrosoft Bing preview
bitlybotbit.ly bot
blekkobotBlekkobot
blexbotBLEXBot (webmeup)
bot@linkfluence.netLinkfluence bot
bufferbotBufferBot
buibui-checkbotbuibui
butterflyTopsy Labs
buzztalkbuzztalk
catchbotCatchBot (catchbot.com)
check_httpNagios monitor
cliqzbotCliqzbot
cmradar/0.1CMRadar/0.1
coldfusionColdFusion http library
commoncrawlCCBot
comodo-webinspector-crawlerComodo
crowsnestCrowsnest
curabotcura.yt
curlcurl unix CLI http client
dap/nethttpDAP/NetHTTP
datagnionbotdatagnion.com/bot.html
daumoaKorean portal and search engine indexing bot
developers.google.com/+/web/snippetGoogle Plus
diffbotDiffbot
digitalpersona fingerprint softwareHP Fingerprint scanner
domain re-animator botDomain Re-Animator Bot
domainsbotDomainsBot
domaintunocrawlerDomainTuno
dotbotDot Bot
duckduckDuck Duck Go
elb-healthcheckerAWS ELB HealthChecker
embedlyEmbedly
eoaagentEOAAgent
eventmachine httpclientRuby http library
everyonesocialbotEveryoneSocial
evrinidEvri bot
exabotExalead's bot
exaleadcloudviewExaleadCloudView
facebookexternalhitFacebook Bot
facebotFacebook Bot
feedburnerRSS bot
feedfetcher-googleGoogle Feedfetcher
findxbotFindxbot
flipboardproxyFlipboardProxy
friendfeedbotFriendFeed
genieoGenieo Web filter bot
getprismatic.comgetprismatic.com
gigabotGigabot spider
gimme60botGimme60 (gimme60.com)
gimmeusabotGimme60 (gimme60.com)
go http packageGo http library
google page speed insightsGoogle Page Speed Insights
google Web PreviewGoogle Instant Previews crawler
google-structured-data-testing-toolGoogle-StructuredDataTestingTool
google-structureddatatestingtoolGoogle-StructuredDataTestingTool
googlebotGoogle Bot
googlestackdrivermonitoring-uptimechecksGoogleStackdriverMonitoring-UptimeChecks
grapeshotcrawlerGrapeshotCrawler
gravitybotGravity Bot
hatena::bookmarkHatena::Bookmark
heritrixheritrix
htmlparserHTMLParser
http_request2HTTP_Request2
httpclientHTTPClient
https://developers.google.com/+/web/snippet (opens in a new tab)Google+ Snippet Fetcher
hubspotHubSpot
ia_archiverInternet Archive (WayBackMachine)
icoreserviceiCoreService
idmarchidmarch.org/bot.html
inagistURL resolver
insieveInsieve Bot
insitesbotInsitesbot
instapaperInstapaper
istellabotIstellaBot
jackjack
jakarta commonsJakarta Commons HttpClient
javaGeneric Java http library
jetslideJetslide
js-kitURL resolver
kemvibotKemvi
kimengiKimengi Bot
knows.isknows.is
kojitsubotKojitsubot
komodiabotKomodiaBot
krakenkraken
laconicaLaconica
libwww-perlPerl client-server library
lijit crawlerLijit
linkdexbotLinkdex Bot
linkedinbotLinkedIn
linkscrawlerLinksCrawler
linodeLinode Longview
lipperheyLipperhey
livelapbotLivelapbot
loadtimebotLoad Time Bot
longurlURL expander service
ltx71ltx71.com
lumibotLumibot
lwp-trivialAnother Perl library
magpie-crawlermagpie-crawler
mail.ru_botMail.ru Bot
meanpathbotmeanpath
mediapartners-googleGoogle Adsense bot
megaindex.ruMegaIndex
memorybotmignify.com/bot.html
metauriMetaURI
mfe_expandMcafee spider
mir web crawlerMIR web crawler
mj12botMajestic-12 spider
mojeekbotMojeek UK search crawler
mrchromeMrChrome
ms search 6.0 robotMS Search 6.0 Robot
msnbot-mediaMicrosoft media bot
msnbotMicrosoft bot
nerdybotNerdyBot
netcraftNetcraft
netstatenetEstate NE Crawler
netvibesPersonalized dashboard bot
netzcheckbotnetzcheck
newrelicmonitorNewRelic monitor
newrelicpingerNewRelicPinger
newsmenewsme
niki-botniki-bot
ningNING
nutchApache search spider
openhosebotOpenHoseBot
orangebotOrangeBot
pagesinventorypagesinventory.com
panoptaMonitoring service
paperlibotPaperLi
peerindexpeerindex
percolatecrawlerPercolateCrawler
perfectmarketkwtbotPerfectMarket
phantomjsPhantomJS
pingdomPingdom monitoring
pinterestPinterest
plukkiebotje.com/plukkie.htm
privacyawarebotPrivacyAwareBot
proximicProximic Spider
psbot-pagePicsearch
publiclibraryarchive.orgpubliclibraryarchive.org
pycurlPython http library
python-httplib2Python-httplib2
python-requestsPython http library
python-urllibPython http library
queryseekerQuerySeekerSpider
quicklookQuickLook
re-animatorDomain Re-Animator Bot
readabilityReadability
rebelmouseRebelMouse
redditbotReddit Bot
relateiqRelateIQ
riddlerRiddler Bot
rogerbotSeoMoz spider
rssmicroRSS/Atom Feed Robot (rssmicro.com)
rubyRuby
scrapyScrapy
screaming frog seo spiderScreaming Frog SEO Spider
searchmetricsbotSearchmetricsBot
semrushbotSEO analysis bot
seokicksSEOKicks
seznambotSeznamBot
shopwikiShopWiki
shortlinktranslateLink shortener
showyoubotShowyou iOS app spider
siegeJoe Dog Siege
sistrixSISTRIX
siteuptimeSite monitoring services
slackSlackbot-LinkExpanding
slackbotSlack Bot
slurpYahoo spider
smtbotSimilarTech
socialrankSocialRankIOBot
sogouChinese search engine
spbotOpenLinkProfiler
spidergeneric web spider
spinn3rSpinn3r aggregator
sputnikbotSputnikBot
squiderSquider
statuscakeStatusCake
stripeStripe
test certificate infoC http library?
tineyeTinEye Bot
traackrTraackr Bot
trendictionbotTrendiction Search
turnitinbotTurnitinBot
tweetedtimesThe Tweeted Times
tweetmemebotTweetMeMe Crawler
twikleSocial web search bot
twitjobsearchTwitJobSearch
twitmuninTwitmunin
twitterbotTwitter URL expander
twurlyTwurly
typhoeusTyphoeus
umbotuberMetrics
unwindfetchGnip
uptimerobotUptime Robot
vagabondoVagabondo
vb projectVisual Basic
vigilVigil
vkshareVKontake Sharer
voilabotVoilaBot
vrcrawlerVenture Radar
wasalive-botWasalive Bots
watchsumoWatchSumo
wbsearchbotWare Bay Best Buys
webscoutWebscout
weseeWeSEE
wgetwget unix CLI http client
wordpressWordPress spider
wormlyWormlyBot
wotboxWotbox
xenu link sleuthXenu Link Sleuth
xing-contenttabreceiverXing bot
xovibotXoviBot
yacybotYaCy
yahoo-ad-monitoringYahoo Ad monitoring
yandexYandex
yetiNaver Corp
yourlsYOURLS
zelist.rofeed parser
zibbZIBB spider
zitebotZite
zyborgZyborg

Was this article helpful?

We’d love to learn from your feedback