adivery_events 1.0.0 copy "adivery_events: ^1.0.0" to clipboard
adivery_events: ^1.0.0 copied to clipboard

PlatformAndroid

Flutter plugin to register retatgeting events.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:adivery_events/adivery_events.dart';


void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _adiveryEventsPlugin = AdiveryEvents();

  @override
  void initState() {
    super.initState();
    _adiveryEventsPlugin.configure("7e27fb38-5aff-473a-998f-437b89426f66");
  }

  logUserEvent(){
    var event = UserActionEventBuilder().setActionString("register").build();
    _adiveryEventsPlugin.logEvent(event);
  }

  logArticleEvent() {
    var event = ArticleViewEventBuilder()
        .setTitle("article title")
        .setUrl("https://adivery.com")
        .setKeywords(["ads","events"]).build();
    _adiveryEventsPlugin.logEvent(event);
  }

  logProductEvent() {
    var event = ProductDetailViewEventBuilder()
        .setSKU("1")
        .setTitle("Brand Shoe")
        .setBrand("Adidas")
        .setImage("https://example.com/shoe.img")
        .setAvailable(true)
        .setCategories(["Shoe", "Style"])
        .setCurrency(Currency.irt)
        .setDiscount(1345.1)
        .setPrice(2000000)
        .build();

    _adiveryEventsPlugin.logEvent(event);
  }

  logCustomEvent(){
    var event = Event("__page_view", {
      "page": "product list",
      "duration": "1500"
    }, []);
    _adiveryEventsPlugin.logEvent(event);
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ButtonBar(
            children: [
              MaterialButton(onPressed: logUserEvent, child: const Text("User Event"),),
              MaterialButton(onPressed: logArticleEvent, child: const Text("Article Event"),),
              MaterialButton(onPressed: logProductEvent, child: const Text("Product Event"),),
              MaterialButton(onPressed: logCustomEvent, child: const Text("Custom Event"),),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
120
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to register retatgeting events.

Homepage

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on adivery_events

Packages that implement adivery_events