-
Notifications
You must be signed in to change notification settings - Fork 0
Tagging a ReactJS site
Before using our tagging directives, please make sure you have initialised the AT Internet JavaScript Tracker and selected the desired plugins from within the Tag Composer interface.
Here is a tagging example, it must be adjusted to your needs.
The tagging service “ATInternetService” allows, by default, the tagging of pages and clicks. For this, it contains two methods that can be used from the JavaScript code of your components:
-
sendPage(), to send page information, -
sendClick(), to send click information
Add the call to the smarttag.js file in the index.html of your public folder.
You can use a local file or one deployed on our CDN.
Add the service to your project, for example the file ATInternetService.js:
class ATInternetService {
constructor() {
this.tag = this.newTag({secure: true});
}
newTag(options) {
try {
return new window.ATInternet.Tracker.Tag(options);
} catch(ex) {
return {
dispatch: () => ({}),
page: { set: () => ({}) },
click: { send: () => ({}) }
};
}
}
//@param info: {name: string, level2?: string, chapter1?: string, chapter2?: string, chapter3?: string, customObject?: any}
sendPage(info) {
this.tag.page.set(info);
this.tag.dispatch();
}
//@param info: {elem: any, name: string, level2?: string, chapter1?: string, chapter2?: string, chapter3?: string, type: string, customObject?: any}
sendClick(info) {
this.tag.click.send(info);
}
}
export let tag = new ATInternetService();Import the service in your component :
import { tag } from '../Services/ATInternetService.js';In order to tag a page, juste call the following method anywhere in your component, for example in the componentDidMount() :
componentDidMount() {
tag.sendPage({
name: 'My_screen',
level2: 12,
customObject: {'pageid':'56639A'}
})
}In order to tag a page, juste call the following method anywhere in your component :
tag.sendClick({
name: 'My_click',
level2: 12
})Last update: 28/01/2020
-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android