I’m setting up an ad tracking system using MongoDB and GoogleAnalytics for a site with millions of pageviews monthly. The following schema is what I’m planning to use for Mongo DB (suggestions welcomed):
{
name: 'Ad Name',
image: 'http://cdn.hosteddomain.com/ad/ad.jpg',
link: 'http://linktoadwebsite.com/?ad=123123',
advertiser: 'Ad Client Name',
date: 4,
weight: 0,
clicks: 0,
purchased_clicks: 0,
impressions: 0,
purchased_impressions: 10000,
unique_impressions: 0,
ctr: 0.045,
display_duration: '',
start_time: '',
end_time: '',
status: 0
}
Why I plan to use Google Analytics as well is so I’m not creating a giant database on my server with data that I don’t need immediate access to. The total impression counts and unique impression counts however are important to tracking the ads on each page and need to be present in order to accurately display ads.
My question is: Is there a schema or method that would allow me to track unique visitors/pageviews and keep the database from growing massive?
You can split this data into two separate collections (or even databases on different servers) and store rarely used data in the first one and rest in the second one. So, the second storage will grows more slower.