Skip to main content

User class that defines a user based on clickstream data.

Project description


Defines the vaknl User class. A user (here identified by a dmp_user_id) is a object that is defined by website clickstream data as a basis. The User class contains functions that can transform raw Firestore website clickstream data to well defined Event dataclasses. These Event dataclasses are read and translated into user information. The User class also includes functions to write the user to Firestore.


Firestore read and write permissions within the Google Cloud Platform (GCP), if one wants to make use of the Firestore functionality.


class User

User class where user object is identified by dmp_user_id user.

create_event(clickstream_event_json) @staticmethod

Assigns event to a (event-)dataclass based on event clickstream json.

update_funnel_step(statistics, event) @staticmethod

Updates the funnel step the user is in.


Update user statistics with event.


Adds event to user based on clickstream json and updates statistics.


Adds multiple events to event_list at a time.


Sort (event list) ascending on timestamp.


Outputs list of event dicts (decoded from the list of event dataclasses).


Writes user to firestore.


Gets all available website clickstream data from Firestore for the given dmp_user_id and fills the User class with information.

General script functions

Mostly functions that allow the user of this package to manually set private variables in this module.

set_project_id(name: str)

Set global variable _project_id, which represents the GCP project id. When function is called, it also automatically updates the firestore client.

set_firestore_collection_source(name: str)

Set global variable _firestore_collection_source, which should be the name of the Firestore source collection, from which the website clickstream data is gathered.

set_firestore_collection_destination(name: str)

Set global variable _firestore_collection_destination, which should be the name of the Firestore destination collection to which the user is written.

create_firestore_client(project_id: str)

Sets up Firestore client.


Contains Event dataclass and all sub-dataclasses that can go multiple layers deep.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaknl-user-1.0.19.tar.gz (11.2 kB view hashes)

Uploaded Source

Built Distribution

vaknl_user-1.0.19-py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page