Web Integration¶
Requirements¶
This setup assumes you have already setup your App Key on the Dashboard.
Integration Steps¶
1 |
|
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 `USER_ID`, you can set it later by sending `user_id` tag. It is a string tag. More detailed angular instructions [here](/sdks/web/angular/)
1 2 3 4 5 6 7 8 9 10 11 |
|
Note
To get your APP_KEY
, go to dashboard.contextu.al, where you can see it's name at the top left of the screen.
USER_ID
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, USER_ID is optional, you can set it later by sending user_id
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 Contextual Dashboard.
- Contextual supports tags of: string, numeric and datetime. In the example below, the value for "Plan-49" is "Trial-Period".
String Tags¶
1 2 3 |
|
Numeric Tags¶
1 2 3 |
|
Datetime Tags¶
1 2 3 4 5 6 7 8 9 |
|
Increment Tag Value¶
1 2 |
|
Setup Content-Security-Policy(CSP) (Optional)¶
If your website ( web app ) uses CSP to restrict resource loading then you should add the below settings to the white list to allow your website to use resources ( JS, CSS, images, etc... ) from Contextual.
1 2 3 4 5 6 7 8 9 10 11 |
|
Note
If you want to use external resources e.g. loading a image from facebook then you should add "*.facebook.com" to the white list.