Skip to content

Web Integration

Requirements

This setup assumes you have already setup your App Key on the Dashboard.

Integration Steps

Install Pointzi in your web project. Add this script into your index.html file.

<script>!function(e,t){function n(){var e="https://sdk.pointzi.com/web/",n=[e+"public/css/streethawk-sdk.css"],r=[e+"dist/bundle/streethawk-pointzi-bundle.js"];n.forEach(function(e){var n=t.createElement("link");n.rel="stylesheet",n.href=e+"?v="+(new Date).getTime(),t.body.appendChild(n)}),r.forEach(function(e){var n=t.createElement("script");n.async=!1,n.src=e+"?v="+(new Date).getTime(),t.body.appendChild(n)})}"function"==typeof jQuery?jQuery("document").ready(function(){n()}):n(),e.streethawk=e.streethawk||{ready:function(t){var n=0,r=setInterval(function(){if(e.streethawk.register||600==n)return clearInterval(r),void(600==n?console.error("Time out! Pointzi sdk not loaded."):"function"==typeof t&&t());n++},100)}}}(window,document);</script>

Put initial code to your main js file, example:

For general website, put the code inside your main.js.

For Angular web app, you can register user right after they enter the app by putting the code into root component. Don't worry about SH_CUID, you can set it later by sending sh_cuid tag. It is a string tag. More detailed angular instructions here

streethawk.ready(function() {

    // SH_CUID is optional.
    // You can set it later by sending sh_cuid tag. It is string tag.
    streethawk.register( APP_KEY, EVENT_KEY, SH_CUID ).then(function() {
        // Send String Tag
        let key = "first_name";
        let value = "My First Name";
        window.streethawk.tag.string(key, value);
    });
});

Note

To get your EVENT_KEY, go to dashboard.pointzi.com, click on

SETUP->API->EVENT_KEY.
To get your APP_KEY, go to dashboard.pointzi.com, where you can see it's name at the top left of the screen.
SH_CUID is the name you want to give to your install-id. This name is up to you. For more info visit the Tagging documentation. When you call register method, SH_CUID is optional, you can set it later by sending sh_cuid tag, it is string tag.

User Tagging

You can tag users/devices from your SDK in one line of code.

The SDK looks after the details for the device, you just supply the tag key and value:

  • The tag name (key) is what you want to call it. In the example below "Plan-49" is how you will see this in the Pointzi Dashboard.
  • Pointzi supports tags of: string, numeric and datetime. In the example below, the value for "Plan-49" is "Trial-Period".

String Tags

let key = "Plan-49";
let value = "Trial-Period";
window.streethawk.tag.string(key, value);

Numeric Tags

let key = "BidValue";
let value = 549;
window.streethawk.tag.numeric(key, value);

Datetime Tags

// Tagging using predefined StreetHawk tag.
let key = "sh_registered";
let value = new Date();
window.streethawk.tag.datetime(key, value);

// Tagging using custom tag.
let key = "Birthday";
let value = new Date();
window.streethawk.tag.datetime(key, value);

Increment Tag Value

let key = "PageVisited";
window.streethawk.tag.increment(key);